updateKey method

V updateKey(
  1. K key,
  2. V updater(
    1. V value
    ), {
  3. V ifAbsent()?,
})

Update value for key (named updateKey to avoid shadowing Rx.update)

Implementation

V updateKey(K key, V Function(V value) updater, {V Function()? ifAbsent}) {
  final newMap = Map<K, V>.from(value);
  final result = newMap.update(key, updater, ifAbsent: ifAbsent);
  value = newMap;
  return result;
}