where method

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

Filters a map based on a predicate.

Implementation

Map<K, V> where(bool Function(K key, V value) test) {
  final result = <K, V>{};
  forEach((key, value) {
    if (test(key, value)) {
      result[key] = value;
    }
  });
  return result;
}