whereKey method

Map<K, V> whereKey(
  1. bool test(
    1. K
    )
)

Returns a new Map containing all the entries of this for which the key satisfies test.

Example:

var map = {'a': 1, 'bb': 2, 'ccc': 3}
map.whereKey((key) => key.length > 1); // {'bb': 2, 'ccc': 3}

Implementation

Map<K, V> whereKey(bool Function(K) test) =>
    // Entries do not need to be cloned because they are const.
    Map.fromEntries(this.entries.where((entry) => test(entry.key)));