askYesNo method
Implementation
bool askYesNo(String question, {bool defaultValue = false}) {
final hint = defaultValue ? '[Y/n]' : '[y/N]';
while (true) {
output.write('$question $hint: ');
final input = readLine()?.trim().toLowerCase() ?? '';
if (input.isEmpty) return defaultValue;
if (input == 'y' || input == 'yes') return true;
if (input == 'n' || input == 'no') return false;
output.write('Please answer y or n.\n');
}
}