confirm static method
Display a confirmation prompt (Y/n)
Implementation
static bool confirm(String question, {bool defaultValue = true}) {
final defaultHint = defaultValue ? 'Y/n' : 'y/N';
stdout.write('\x1B[36m?\x1B[0m $question [$defaultHint] ');
final response = stdin.readLineSync()?.toLowerCase().trim();
if (response == null || response.isEmpty) {
return defaultValue;
}
return response == 'y' || response == 'yes';
}