putOrRemove method

void putOrRemove(
  1. K key,
  2. V? value
)

Implementation

void putOrRemove(K key, V? value) {
  if (value != null) {
    this[key] = value;
  } else {
    remove(key);
  }
}