update method

void update(
  1. T updater(
    1. T current
    )
)

Updates the value using a transformation function updater.

The updater receives the current value and should return the new value.

Implementation

void update(T Function(T current) updater) {
  // Since we modifying value via updater, we need to manually trigger setter
  // or notifyListeners. Accessing .value here might trigger subscription
  // if inside watcher, which is desired.
  value = updater(_value);
}