getMap<K2, V2> method
Safely gets a nested Map from the map.
Example: map.getMap<String, dynamic>('user')
Implementation
Map<K2, V2> getMap<K2, V2>(K key, {Map<K2, V2> defaultValue = const {}}) {
final value = this[key];
if (value is Map) {
try {
return Map<K2, V2>.from(value);
} catch (_) {
return defaultValue;
}
}
return defaultValue;
}