promptAny method

Future<List<String>> promptAny(
  1. String question, {
  2. String separator = ',',
  3. List<String>? defaultValues,
  4. String? validate(
    1. List<String> answer
    )?,
  5. String? placeholder,
})

Asks question for many values on one line, split on separator and trimmed, the blank ones dropped; an empty line answers defaultValues, or none without them.

validate refuses the values with a message, and the question is asked again. It asks as prompt does, the values shown joined by commas once answered; where nobody can answer, without defaultValues, or with values validate refuses, PromptAnswerRequiredException.

final tags = await Cli.current.promptAny(
  'Tags?',
  defaultValues: ['cli', 'dart'],
);

Implementation

Future<List<String>> promptAny(
  String question, {
  String separator = ',',
  List<String>? defaultValues,
  String? Function(List<String> answer)? validate,
  String? placeholder,
}) => _prompter.promptAny(
  question,
  separator: separator,
  defaultValues: defaultValues,
  validate: validate,
  placeholder: placeholder,
);