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) {
  core.Map<K, V?> result = {};
  if (from == null) {
    return null;
  }
  if (from is core.Map) {
    for (K key in from.keys) {
      if (_map.containsKey(key)) {
        result[key] = _map[key]!._cast(from[key], "map entry", key);
      } else {
        result[key] = from[key];
      }
    }
    return result;
  }
  return throw new FailedCast(context, key, "not a map");
}