ask_sync method
Prompts a user for a yes or no answer.
The following are considered yes responses:
- yes
- y
- sure
- ok
- yep
- yeah
- true
- yerp
You can add more to the list of positive responses using the positive
argument.
The input will be changed to lowercase and then checked.
Implementation
bool? ask_sync({
final List<String> positive = const [],
}) {
final answer = prompt_sync();
if (answer == null) {
// ignore: avoid_returning_null
return null;
} else {
return DC_YES_RESPONSES.contains(answer.toLowerCase()) || positive.contains(message.toLowerCase());
}
}