filterMap<K, V> static method

Map<K, V> Function(Map<K, V>) filterMap<K, V>(
  1. bool predicate(
    1. K,
    2. V
    )
)

Implementation

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