updateIf method

void updateIf(
  1. bool condition(
    1. T
    ),
  2. T newValue
)

Updates the ValueNotifier's value to newValue if condition returns true.

Implementation

void updateIf(bool Function(T) condition, T newValue) {
  if (condition(_value)) {
    value = newValue;
  }
}