SelectList class abstract final

A keyboard-navigated, bottom-anchored selection list.

The list renders only its own rows at the bottom of the terminal and updates them in place as the user navigates with the arrow keys (or j/k). It works on modern Windows consoles as well as macOS and Linux terminals.

Example:

final fruit = await SelectList.choose<String>(
  prompt: 'Pick a fruit',
  options: ['Apple', 'Banana', 'Cherry'],
);

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

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

Static Methods

choose<T>({required List<T> options, required InlineTerminal terminal, String? prompt, String label(T option)?, int initialIndex = 0, bool isEnabled(T option)?, SelectListStyle? style}) Future<T?>
Shows a single-choice list and returns the chosen value, or null if the user cancelled with Escape or q.
chooseMultiple<T>({required List<T> options, required InlineTerminal terminal, String? prompt, String label(T option)?, Iterable<T> initiallySelected = const [], int minSelections = 0, int? maxSelections, bool isEnabled(T option)?, SelectListStyle? style}) Future<List<T>?>
Shows a multi-choice list and returns the chosen values, or null if the user cancelled with Escape or q.