getBool method
Implementation
bool getBool(String key, {bool? defaultValue}) {
final s = _env[key];
if (s == null) {
if (defaultValue != null) return defaultValue;
throw StateError('Missing env "$key"');
}
final t = s.trim().toLowerCase();
if (t == 'true' || t == '1' || t == 'yes' || t == 'y' || t == 'on') {
return true;
}
if (t == 'false' || t == '0' || t == 'no' || t == 'n' || t == 'off') {
return false;
}
throw FormatException('Env "$key" is not a bool: "$s"');
}