where method Null safety

Map<K, V> where(
  1. BoolFunctionMap func
)

Works like List.where, you put in a function that takes a MapEntry and returns a bool. This will return new Map where the above function is true.

Implementation

Map<K, V> where(BoolFunctionMap func) {
  Map<K, V> newMap = {};
  for (MapEntry entry in entries) {
    if (func(entry)) {
      newMap[entry.key] = entry.value;
    }
  }
  return newMap;
}