add method
void
add(
- K key,
- V item
Add item
If the key already exists, it will be updated only if the value is different.
Parameters
key
: The key to additem
: The value to add
Implementation
void add(K key, V item) {
update(key, (v) => v.notEquals(item) ? item : v, ifAbsent: () => item);
}