InlineCommander class
One-shot interactive prompts built on top of the Commander TUI runtime.
Each interactive method opens its own runTerminal in flow mode, captures
a single value, and tears down cleanly. Status methods write directly to
stdout without entering raw mode.
final commander = InlineCommander();
final name = await commander.ask('Your name?');
commander.success('Hello $name');
Constructors
- InlineCommander({ThemeData? theme, Terminal? terminal, IOSink? sink, bool allowNonInteractive = false})
- Creates a new commander.
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
-
ask(
String message, {String? defaultValue, String? placeholder, bool obscure = false, String? validate(String value)?}) → Future< String> - Asks the user for a free-form string answer.
-
confirm(
String message, {bool defaultValue = false}) → Future< bool> - Asks a y/n question and returns the boolean answer.
-
dispose(
) → Future< void> -
Releases any internally-cached terminal. Call this when you're done
issuing prompts (typically at the end of your program). No-op if the
commander was constructed with an explicit
terminal:argument. -
error(
String message) → void -
info(
String message) → void -
multiSelect<
T> (String message, {required List< T> options, List<T> defaults = const [], String display(T item)?, int? minSelections, int? maxSelections, int visibleCount = 5, bool filterable = false}) → Future<List< T> > -
Lets the user pick multiple values from
options. Space toggles each row; Enter submits. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
number(
String message, {num? min, num? max, num? defaultValue, bool allowDecimals = false, String? validate(num value)?}) → Future< num> - Asks for a numeric answer with optional bounds.
-
password(
String message, {String? validate(String value)?}) → Future< String> -
Sugar for ask with
obscure: true. The submitted value never appears on screen. -
select<
T> (String message, {required List< T> options, T? defaultValue, String display(T item)?, int visibleCount = 5, bool filterable = false}) → Future<T> -
Lets the user pick a single value from
options. -
success(
String message) → void -
task<
T> (String description, Future< T> work()) → Future<T> -
Runs
workwhile showing a spinner. The future's value is returned; thrown errors propagate to the caller after the terminal is restored. -
toString(
) → String -
A string representation of this object.
inherited
-
warn(
String message) → void
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited