boolean method
Extracts a boolean value.
Returns the boolean value corresponding to the key
.
The key must exist in the map or a defaultValue
is provided.
Otherwise, a ConfigExceptionKeyMissing exception will be thrown.
To allow the key to be missing, use the booleanOptional method.
Default value
When a defaultValue is provided a value is always returned. So while the key does not have to appear in the config, there is always a value available. To the config it is optional, but to the program it behaves the same as a mandatory key.
Implementation
bool boolean(String key, {bool? defaultValue}) =>
_boolean(key, optional: false, defaultValue: defaultValue)!;