where<K, V> method

Map<K, V> where<K, V>(
  1. bool test(
    1. K key,
    2. V value
    )
)

Implementation

Map<K, V> where<K, V>(bool Function(K key, V value) test) {
  final result = <K, V>{};
  forEach((key, value) {
    if (key is K && value is V && test(key, value)) {
      result[key] = value;
    }
  });
  return result;
}