filterNot method

Map<K, V> filterNot(
  1. bool predicate(
    1. MapEntry<K, V> entry
    )
)

Returns a new map containing all key-value pairs not matching the given predicate.

The returned map preserves the entry iteration order of the original map.

Implementation

Map<K, V> filterNot(bool Function(MapEntry<K, V> entry) predicate) {
  final result = <K, V>{};
  for (final entry in entries) {
    if (!predicate(entry)) {
      result[entry.key] = entry.value;
    }
  }
  return result;
}