replace method

void replace(
  1. T item, {
  2. String? key,
})

Updates the value of item.

This only works when the ids of the new and old value are identical.

Implementation

void replace(T item, {String? key}) {
  this[_getKey(key ?? item)] = item;
}