require method
The value, throwing when unset.
Use for anything the app genuinely cannot run without. Failing at startup with the variable's name beats failing on the first request that needed it, in a stack trace that does not mention configuration at all.
Implementation
String require(String name) {
if (this[name] case final value?) {
return value;
}
throw StateError(
'Required environment variable "$name" is not set. '
'Set it in the deployment environment, or supply a default.',
);
}