mapWithDefault method
Returns a new map with the same keys as this map but with the specified
defaultValue
for all values that are null. If defaultValue
is null,
it simply returns a copy of the original map.
Implementation
Map<K, dynamic> mapWithDefault(dynamic defaultValue) {
return defaultValue != null
? map((k, v) => MapEntry(k, v ?? defaultValue))
: Map.of(this);
}