SearchPrompt<T> class cli

Pick one option by typing to filter the list, like a command palette.

Typing narrows the list with Fuzzy matching, best match first; the arrows move through what is left and Enter picks.

Inheritance

Constructors

SearchPrompt(String question, List<T> options, {String format(T option)?, String note(T option)?, int? defaultIndex, int? pageSize})
Creates a searchable list asking question.

Properties

bodyCursor → CursorSpot?
Where the blinking cursor goes in body, if anywhere. Used when inlineCursor is null.
no setterinherited
defaultIndex → int?
The option to give back in PromptMode.unattended, if any.
final
error ↔ String?
A problem to show under the prompt, like a failed check. Cleared on every key press.
getter/setter pairinherited
fallbackHint → String
The dim hint shown in line mode, like (1-5) or [y/N].
no setterinherited
hashCode → int
The hash code for this object.
no setterinherited
inlineCursor → int?
Where the blinking cursor goes in inline, in screen columns; null hides it. Text inputs use this.
no setteroverride
keys → List<KeyHint>
The keys shown in the hints line.
no setteroverride
labels → List<String>
The text shown for each option.
final
notes → List<String>
Dim text after each option, which is searched too.
final
options → List<T>
The options to search.
final
question → String
The question at the top of the prompt.
finalinherited
result → T
The answer, read once onKey gives back KeyResult.done.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
theme → AnsiTheme
The theme in use.
no setterinherited
unattended → T?
The answer used in PromptMode.unattended, or null if there isn't one.
no setteroverride

Methods

body() → List<String>
The lines under the question line. Defaults to none.
override
describe(T value) → String
How value is shown after the question once answered.
override
fallback() → T
Asks the question without a live screen, one typed line at a time.
override
inline() → String
The text after the question, on the same line. Defaults to nothing.
override
moreLine(int hidden, {required bool above}) → String?
A scroll hint line, like ↑ 3 more, or null when nothing is hidden.
inherited
muted(String text) → String
text in the theme's AnsiTheme.muted colour.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onKey(KeyPress press) → KeyResult
Reacts to press and says what should happen next.
override
pageSizeFor(int count, {int reserved = 4, int? max}) → int
How many list rows fit under the prompt, leaving room for reserved other lines.
inherited
parse(String typed) → ({String? problem, T? value})
Turns a typed line into an answer, for line mode.
inherited
pointed(String text) → String
text as the highlighted row: the pointer, bold, in the highlight.
inherited
toString() → String
A string representation of this object.
inherited
unpointed(String text) → String
text as a normal row, lined up with pointed rows.
inherited

Operators

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