customcast method

Map<K, V?>? customcast(
  1. dynamic from,
  2. String context,
  3. dynamic key
)

Implementation

core.Map<K, V?>? customcast(dynamic? from, core.String context, dynamic key) {
  if (from == null) {
    return null;
  }
  if (from is core.Map) {
    var result = <K, V?>{};
    for (var key in from.keys) {
      var newKey = _key._cast(key, "map entry", key);
      result[newKey!] = _value._cast(from[key], "map entry", key);
    }
    return result;
  }
  return throw new FailedCast(context, key, "not a map");
}