add method
Returns a new map containing the current map plus the given key:value. However, if the given key already exists in the set, it will remove the old one and add the new one.
Implementation
M<K, V> add({required K key, required V value}) {
bool contains = containsKey(key);
if (!contains)
return MAdd<K, V>(this, key, value);
else {
V? oldValue = this[key];
return (oldValue == value) //
? this
: MReplace<K, V>(this, key, value);
}
}