mapCastOfType<K, V> function

Map<K, V>? mapCastOfType<K, V>(
  1. dynamic map,
  2. String key
)

Returns a valid Map<K, V> found at the specified Map key, null otherwise.

Implementation

Map<K, V>? mapCastOfType<K, V>(dynamic map, String key) {
  final dynamic value = map is Map ? map[key] : null;
  return value is Map ? value.cast<K, V>() : null;
}