union method
Combine the key/value of this Map and map
using combine
where the key is the same.
Implementation
Map<K, V> union(
Eq<K> eq,
V Function(V x, V y) combine,
Map<K, V> map,
) {
var result = {...this};
for (var entry in map.entries) {
if (lookupKeyEq(eq, entry.key) case Some(value: var key)) {
result.update(key, (v) => combine(entry.value, v));
} else {
result[entry.key] = entry.value;
}
}
return result;
}