update method

void update(
  1. T newValue
)

Updates the value and notifies listeners if changed

Implementation

void update(T newValue) {
  if (_value == newValue) return;

  final stopwatch = Stopwatch()..start();
  _value = newValue;
  notifyListenersTransaction();
  stopwatch.stop();

  if (PerformanceMonitor.isEnabled && stopwatch.elapsedMilliseconds > 0) {
    PerformanceMonitor.trackUpdate(
      runtimeType.toString(),
      stopwatch.elapsed,
    );
  }
}