promptYesNo static method

Future<bool> promptYesNo(
  1. String question
)

Implementation

static Future<bool> promptYesNo(String question) async {
  while (true) {
    stdout.write('$question (Y/N): ');
    String? input = stdin.readLineSync()?.trim().toLowerCase();
    if (input == 'yes' || input == 'y') {
      return true;
    }
    return false;
  }
}