singleSelect<T> function

T singleSelect<T>(
  1. String message, {
  2. required List<T> options,
  3. required String display(
    1. T
    ),
})

Prompts the user to select a single option from a list.

Implementation

T singleSelect<T>(
  String message, {
  required List<T> options,
  required String Function(T) display,
}) {
  final index = Select.withTheme(
    prompt: message,
    options: List.of(options.map(display)),
    theme: radioTheme,
  ).interact();
  return options[index];
}