chooseAny<T> method

  1. @override
List<T> chooseAny<T>(
  1. String message, {
  2. required List<T> choices,
  3. List<T>? defaultValues,
  4. String display(
    1. T
    )?,
})
override

Prompts user to select multiple choices from choices.

Implementation

@override
List<T> chooseAny<T>(String message,
    {required List<T> choices,
    List<T>? defaultValues,
    String Function(T)? display}) {
  if (_isJsonOutput) return defaultValues ?? [];

  // Hack to prevent mason_logger from breaking when choices cause terminal scrolling.
  // We pre-allocate the lines to force scrolling before saving the cursor.
  final linesNeeded = choices.length + 1;
  io.stdout.write('\n' * linesNeeded);
  io.stdout.write('\x1B[${linesNeeded}A');

  return _logger.chooseAny<T>(message,
      choices: choices, defaultValues: defaultValues, display: display);
}