choose method

Answer choose()

Implementation

Answer choose() {
  final dialog = CLI_Dialog(listQuestions: [
    [
      {'question': title, 'options': choices},
      'result'
    ]
  ]);

  final answer = dialog.ask();
  final result = answer['result'] as String;
  final index = choices.indexOf(result);

  return Answer(result: result, index: index);
}