filterValues method

Map<K, V> filterValues(
  1. bool predicate(
    1. V value
    )
)

Filters the map based on a condition applied to its values.

Example:

var map = {'first': 1, 'second': 2, 'third': 3};
print(map.filterValues((value) => value > 1)); // Output: {'second': 2, 'third': 3}

Implementation

Map<K, V> filterValues(bool Function(V value) predicate) =>
    Map.fromEntries(entries.where((entry) => predicate(entry.value)));