question_asker_bm 0.0.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new58

question_asker_bm #

This library can be used to create a multiple choice and yes/no type question wizard CLI in dart

Usage #

Import the package #

To use this library, follow the library installation instructions.

Use the Library #

Add the following import to your Dart code:

import 'package:question_asker_bm/question_asker_bm.dart';

Instantiate Asker class with the scopes you want:

final asker = new Asker();

List of Methods you can use: #

1. askMultiple(question,options) #

     a) First argument is the question to ask
     b) Second argument is the list of answers(options) for the given question
    *Note*: This function returns the option selected by the user

2. askBinary(question) #

    => Takes an argument as the question to ask
    *Note*: This function return either TRUE or FALSE based on the value selected by the user. 
            a) This returns true if user type y or yes 
            b) This returns flase if user type f or false 

You can now use the Asker class to use the methods in your Dart code, e.g.

void main()
        {
            //craete a list of Options for a given question
            final options = [new Option('I like Green', '#00ff00'),
                            new Option('I like White', '#FFFFFF')];

            //creating the object of Asker class
            final asker = new Asker();

            //Asking a multiple choice quesition along with passing the options for the question
            String choosenAns = asker.askMultiple('What color do you like?', options);

            //asking a binary type means Yes or No type Question    
            bool ansBinary = asker.askBinary('Do you like This Lib?');

            //displaying the result choosen by the user
            print(choosenAns);  //#00ff00 or #FFFFFF
            print(ansBinary);   //true or false
        }

0.0.2 #

  • Promter class is changed as Asker

0.0.1 #

  • initial release

example/main.dart

///imporing the rqquired files
import 'package:question_asker_bm/question_asker_bm.dart';

///start of main function
void main()
{
	final options = [new Option('I like Green', '#00ff00'),
					new Option('I like White', '#ffffff')];

	final asker = new Asker();
	String choosenAns = asker.askMultiple('What color do you like?', options);

	bool ansBinary = asker.askBinary('Do you like This Lib?');

	print(choosenAns);
	print(ansBinary);
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  question_asker_bm: ^0.0.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:question_asker_bm/question_asker_bm.dart';
  
Version Uploaded Documentation Archive
0.0.2 Jan 28, 2019 Go to the documentation of question_asker_bm 0.0.2 Download question_asker_bm 0.0.2 archive
0.0.1 Jan 27, 2019 Go to the documentation of question_asker_bm 0.0.1 Download question_asker_bm 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
19
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
58
Learn more about scoring.

We analyzed this package on Feb 20, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.13+1

Platforms

Detected platforms: Flutter, other

Primary library: package:question_asker_bm/question_asker_bm.dart with components: io.

Health suggestions

Format lib/question_asker_bm.dart.

Run dartfmt to format lib/question_asker_bm.dart.

Format lib/src/asker.dart.

Run dartfmt to format lib/src/asker.dart.

Format lib/src/option.dart.

Run dartfmt to format lib/src/option.dart.

Format lib/src/terminal.dart.

Run dartfmt to format lib/src/terminal.dart.

Maintenance suggestions

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK <3.0.0