filterMap<K, V> function

Map<K, V> filterMap<K, V>(
  1. Map<K, V> map,
  2. bool predicate(
    1. K key,
    2. V value
    )
)

Filters key-value pairs in a Map

map Source map predicate Filter condition function

Implementation

Map<K, V> filterMap<K, V>(
  Map<K, V> map,
  bool Function(K key, V value) predicate,
) {
  return Map.fromEntries(
    map.entries.where(
      (entry) => predicate(entry.key, entry.value),
    ),
  );
}