where method
Returns a new Map containing all entries that satisfy test.
The new Map preserves the entry iteration order of the this Map.
Implementation
Map<K, V> where(bool Function(K key, V value) test) {
final result = <K, V>{};
for (final MapEntry(:key, :value) in entries) {
if (!test(key, value)) continue;
result[key] = value;
}
return result;
}