findKey function Null safety
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;
}