whereKey method

Map<K, V> whereKey(
  1. Predicate<K> p
)

Returns a new Map by filtering its keys using the given predicate.

Implementation

Map<K, V> whereKey(Predicate<K> p) {
  Map<K, V> map = {};

  forEach((k, v) {
    if (p(k)) map[k] = v;
  });

  return map;
}