Prompt class

Interactive prompts for the CLI's wizards.

Kept in one place so every wizard asks questions the same way: a dim hint for the default, numbered menus instead of free-text matching, and a best-effort attempt to keep secrets off the screen — see secret, which warns rather than fails where the terminal will not disable echo.

Constructors

Prompt([ColorizeLogger? logger])
Creates a prompt bound to logger for its non-question output.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

confirm(String question, {bool defaultValue = true}) bool
Asks a yes/no question.
multiSelect<T>(String question, List<T> options, {required String label(T), String describe(T)?, List<T> defaults = const []}) List<T>
Asks the user to pick any number of options from a numbered list.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
secret(String question, {bool allowEmpty = false}) String
Asks for a secret, with terminal echo disabled while typing.
select<T>(String question, List<T> options, {required String label(T), String describe(T)?, int defaultIndex = 0}) → T
Asks the user to pick one of options from a numbered list.
summary(Map<String, String?> values) → void
Prints a key value block, used to review answers before committing.
text(String question, {String? defaultValue, bool allowEmpty = false, String? validate(String)?}) String
Asks for a line of text.
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

isInteractive bool
Whether the terminal can answer questions at all.
no setter
readLine String? Function()
Source of a single line of input. Replaced in tests to drive a wizard.
getter/setter pair