getDouble method

double getDouble(
  1. String key
)

Implementation

double getDouble(String key) {
  if (!containsKey(key)) {
    throw Exception("json.getDouble($key). No key");
  }
  final value = this[key];
  if (value is num) {
    return value.toDouble();
  }
  if (value is String) {
    return double.parse(value);
  }
  if (value is bool) {
    return value ? 0.0 : 1.0;
  }
  throw Exception("could not parse $value to double");
}