CliDialog class

This is the most important class which should usually be instantiated when building CLI dialogs.

Constructors

CliDialog({List? messages, List? questions, List? booleanQuestions, List? listQuestions, List<String>? order, bool trueByDefault = false, bool navigationMode = false, String? resume = ''})
This is the default constructor to create a CLI Dialog You can pass lists of normal questions, booleanQuestions, listQuestions. All these named parameters are optional as long as at least one of them is given. Furthermore you can pass a particular order. If no order is given then the default order is used (see README.md) There is also trueByDefault (false by default) which indicates how booleanQuestions behave if no input is given There are basic format checks which try to prevent you from passing invalid argmuents.
CliDialog.std(StdinService _std_input, StdoutService _std_output, {List? messages, List? questions, List? booleanQuestions, List? listQuestions, List<String>? order, bool trueByDefault = false, bool navigationMode = false})
This named constructor should mostly be used when unit testing.

Properties

answers Map
This is where the results = answers from the CLI dialog go. This map is updated and returned when calling ask.
getter/setter pair
booleanQuestions List?
This is where the boolean questions are stored during runtime. Feel free to access it like any other list.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
listQuestions List?
This is where the list questions are stored during runtime (where the user selects a value). Feel free to access it like any other list.
getter/setter pair
messages List?
Messages inform the user without asking a question. A key must be provided for each message if you want to use a custom order.
getter/setter pair
Navigation mode means that every question is displayed with a number which you can use to navigate through questions
getter/setter pair
order List<String>?
This list contains the order in which the questions are asked in the dialog. Feel free to access it like any other list.
getter/setter pair
questions List?
This is where the regular questions are stored during runtime.
getter/setter pair
resume String?
Resume moed means that progress in your CLI dialog is automatically saved with each question so you can savely Quit and resume later. Specify a file path where you progress will be saved and loaded from
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
trueByDefault bool
Indicates the default behaviour of boolean questions when no input (except '\n') is given.
getter/setter pair

Methods

addQuestion(dynamic p_question, dynamic key, {dynamic is_boolean = false, dynamic is_list = false, dynamic is_message = false}) → void
This method is another way of adding questions after instantiating CLI_Dialog Pass is_bool or is_list as a named argument to indicate the type of question you are adding (boolean qualifier).
addQuestions(dynamic p_questions, {dynamic is_boolean = false, dynamic is_list = false, dynamic is_message = false}) → void
Same as addQuestion but you can add multiple questions (of the same type)
ask() Map
Use this method to retrieve the results from your CLI dialog. A map is being returned which you can query using your keys.
getCustomNavList() List
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited