partition<K, V> method
Split map into two maps based on the predicate
.
Returns a list of two maps.
Implementation
Pair<Map<K, V>, Map<K, V>> partition<K, V>(
bool Function(K key, V value) predicate) {
final map1 = <K, V>{};
final map2 = <K, V>{};
for (final key in keys) {
if (predicate(key as K, this[key] as V)) {
map1[key] = this[key] as V;
} else {
map2[key] = this[key] as V;
}
}
return Pair(map1, map2);
}