runSelectPrompt<T> function

Future<T?> runSelectPrompt<T>(
  1. SelectModel<T> model,
  2. Terminal terminal, {
  3. ProgramOptions? options,
})

Runs a SelectModel and resolves to the selected item, or null if cancelled.

Implementation

Future<T?> runSelectPrompt<T>(
  SelectModel<T> model,
  Terminal terminal, {
  ProgramOptions? options,
}) async {
  final controller = _PromptController<T?>();
  final program = Program(
    _SelectPromptModel<T>(model, controller),
    options: options ?? promptProgramOptions,
    terminal: terminal,
  );
  await program.run();
  return await controller.future;
}