update method

void update(
  1. T fn(
    1. T? value
    )
)

Updates the value based on the provided function.

Implementation

void update(T Function(T? value) fn) {
  final T updatedValue = fn(value);
  if (updatedValue != null) {
    value = updatedValue;
  }
}