update method

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

Update value for key using function.

Implementation

void update(K key, V Function(V? value) updater) {
  final newMap = Map<K, V>.from(val);
  newMap[key] = updater(newMap[key]);
  emit(newMap);
}