chooseAny<T> method
Asks question for any of choices, which must not be empty,
answered in the order of choices: at least min of them, at most
max (no limit when null); a choice of fewer or more is refused
with a message and asked again.
It asks as chooseOne does, Space toggling the choice the cursor is
on, those of defaultValues toggled at first; in the plain mode the
numbers are separated by commas or blanks (1,3), and an empty
answer is defaultValues. Once answered they are shown joined by
commas. Where nobody can answer, a prompt without defaultValues,
or with fewer or more of them than min and max allow, throws
PromptAnswerRequiredException.
final features = await cli.chooseAny(
'Features?',
choices: ['Linter', 'Docker', 'Tests'],
defaultValues: ['Linter'],
);
Implementation
Future<List<T>> chooseAny<T>(
String question, {
required List<T> choices,
List<T>? defaultValues,
String Function(T choice)? display,
bool? filter,
int min = 0,
int? max,
}) => _prompter.chooseAny(
question,
choices: choices,
defaultValues: defaultValues,
display: display,
filter: filter,
min: min,
max: max,
);