keysWhere method

List<K> keysWhere(
  1. bool test(
    1. K,
    2. V
    )
)

Returns a list of keys that match the predicate.

Example:

{'a': 1, 'b': 2, 'c': 3}.keysWhere((k, v) => v > 1);
// ['b', 'c']

Implementation

List<K> keysWhere(bool Function(K, V) test) {
  final List<K> keys = <K>[];
  forEach((K key, V value) {
    if (test(key, value)) {
      keys.add(key);
    }
  });
  return keys;
}