filterWithKey method

Map<K, V> filterWithKey(
  1. bool test(
    1. K key,
    2. V value
    )
)

Returns a new Map containing all the elements of this Map where key/value satisfies test.

Implementation

Map<K, V> filterWithKey(bool Function(K key, V value) test) => {
      for (var (MapEntry(:key, :value)) in entries)
        if (test(key, value)) key: value
    };