getDouble method Null safety

double? getDouble(
  1. String key,
  2. [double? defaultValue]
)

Retrieve a value from this map

Implementation

double? getDouble(String key, [double? defaultValue]) {
  if (!containsKey(key)) {
    return defaultValue;
  }

  dynamic valueDyn = this[key];

  if (valueDyn is double) {
    return valueDyn;
  }

  if (valueDyn is String) {
    return stringToDouble(valueDyn, defaultValue);
  }

  return defaultValue;
}