except<K, V> static method

Map<K, V> except<K, V>(
  1. Map<K, V> map,
  2. Iterable<K> keys
)

Returns a new map containing all entries except those whose keys are in keys.

Implementation

static Map<K, V> except<K, V>(Map<K, V> map, Iterable<K> keys) {
  final exclude = keys.toSet();
  return {
    for (final e in map.entries)
      if (!exclude.contains(e.key)) e.key: e.value,
  };
}