getBool method
Retrieves a boolean value from an environment variable.
Recognizes the following truthy values (case-insensitive):
true,1,yes,on
All other values are considered falsy.
final debug = env.getBool('DEBUG', defaultValue: false);
final verbose = env.getBool('VERBOSE'); // defaults to false
Implementation
@override
bool getBool(String key, {bool defaultValue = false}) {
final value = _env[key]?.toLowerCase();
if (value == null) return defaultValue;
return ['true', '1', 'yes', 'on'].contains(value);
}