updateValue method

Future<void> updateValue(
  1. T newValue
)

Updates the value and triggers all listeners in order, waiting for async completion

Implementation

Future<void> updateValue(T newValue) async {
  _value = newValue;

  for (final listener in _listeners) {
    await Future.sync(() => listener(_value));
  }

  // After all listeners have completed, notify UI consumers

  notifyListeners();
}