getDouble method

double getDouble(
  1. String key, {
  2. double? defaultValue,
})

Implementation

double getDouble(String key, {double? defaultValue}) {
  final s = _env[key];
  if (s == null) {
    if (defaultValue != null) return defaultValue;
    throw StateError('Missing env "$key"');
  }
  final v = double.tryParse(s.trim());
  if (v == null) throw FormatException('Env "$key" is not a double: "$s"');
  return v;
}