SuggestModel class

Interactive text-input with a scrollable prefix-matched suggestion dropdown.

Behaviour mirrors Laravel's SuggestPrompt:

  • Suggestions are filtered by prefix match as the user types.
  • Up/Down (or Tab/Shift-Tab) navigate the visible suggestion list.
  • Accepting a suggestion (Enter when highlighted, Tab) copies it to the input.
  • Pressing Enter when no suggestion is highlighted submits the typed value.
  • Escape / Ctrl+C cancels and emits SuggestCancelledMsg.
  • Left/Right arrow clears the dropdown selection.

Emits SuggestSubmittedMsg on success or SuggestCancelledMsg on cancel.

Inheritance

Constructors

SuggestModel({String prompt = '? ', List<String> options = const [], String placeholder = '', String defaultValue = '', int scroll = 5, String hint = '', bool showHelp = true, SuggestKeyMap? keyMap, SuggestStyles? styles})
Creates a new suggest model.

Properties

defaultValue String
Pre-filled default value.
final
hashCode int
The hash code for this object.
no setterinherited
highlighted int
The index of the highlighted suggestion, or -1 if none.
no setter
hint String
Optional hint line shown below the input.
final
keyMap SuggestKeyMap
Key bindings.
final
matches List<String>
All suggestions that prefix-match the current input.
no setter
options List<String>
The static list of suggestion strings.
final
placeholder String
Placeholder shown when the input is empty.
final
prompt String
The label shown before the input field.
final
rawInput String
The current typed value.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scroll int
Maximum number of suggestions visible at once (scrolled window).
final
showHelp bool
Whether to show the keyboard help line.
final
styles SuggestStyles
Visual styles.
final
visible List<String>
The visible window of matches after applying scroll.
no setter

Methods

init() Cmd?
Returns an optional command to execute on program startup.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
update(Msg msg) → (SuggestModel, Cmd?)
Updates the component state in response to a message.
override
view() String
Renders the current model state for display.
override

Operators

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