findKey function

dynamic findKey(
  1. Map map,
  2. Function predicate
)

it returns the key of the first element predicate returns truthy for instead of the element itself.

Implementation

dynamic findKey(Map map, Function predicate) {
  for (var key in map.keys) {
    if (predicate(map[key])) {
      return key;
    }
  }
  return null;
}