showMultiSelectDialog function
Shows a scrollable terminal selection dialog and returns the set of selected indices.
Only standard ASCII characters should be used in the options, as other
characters may break the width calculations.
Temporarily disables stdin line and echo modes, and restores them before returning. Also intercepts ProcessSignal.sigint to cancel the dialog.
The cursor is hidden for the duration of the dialog and then re-shown. If you want the cursor in a certain state after this dialog you will have to restore it.
The inputStream is a list of input events (typically originating from
stdin or Win32AnsiStdin). See the example/select_dialog.dart for
recommended patterns.
The maxVisibleItems parameter controls how many items are visible in the
dialog at once.
Returns null if the user aborts the dialog (e.g. by pressing Ctrl+C or
escape), there is no terminal attached to stdout, or the terminal is too
small to display the dialog.
Implementation
Future<Set<int>?> showMultiSelectDialog(
List<String> options,
Stream<List<int>> inputStream, {
int maxVisibleItems = 5,
Set<int> initialSelected = const {},
}) => _runDialog(
options,
maxVisibleItems,
inputStream,
multiSelect: true,
initialSelected: initialSelected,
);