mutate method

void mutate(
  1. dynamic updater(
    1. T value
    )
)

Updates the value using the provided updater function. If the updater returns null or true, listeners are notified.

Implementation

void mutate(Function(T value) updater) {
  var result = updater(value);
  if (result is T && result != value) {
    value = result;
  } else if (result == null || result == true) {
    notifyListeners();
  }
}