question_asker_bm 0.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 53

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


///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?');


Use this package as a library

1. Depend on it

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

  question_asker_bm: ^0.0.2

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub 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';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Mar 24, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

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 getting outdated. (-15.34 points)

The package was last published 60 weeks ago.

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.


Package Constraint Resolved Available
Direct dependencies
Dart SDK <3.0.0