confirm method
Prompts the user for a yes/no confirmation.
Implementation
bool confirm(String message, {bool defaultValue = false}) {
if (!_interactive) {
return false;
}
final suffix = defaultValue ? '[Y/n]' : '[y/N]';
_out.write(cliWarning('$message $suffix ', ansiEnabled: _ansiEnabled));
final response = _readLine()?.trim().toLowerCase();
if (response == null || response.isEmpty) {
return defaultValue;
}
return response == 'y' || response == 'yes';
}