update method

Future<T?> update(
  1. Producer<T> current, {
  2. String? debugLabel,
  3. Duration? timeout,
  4. bool? fallbackToCurrent,
})

Implementation

Future<T?> update(Producer<T> current,
    {String? debugLabel, Duration? timeout, bool? fallbackToCurrent}) {
  bool isQueued = _queue(current, debugLabel: debugLabel);

  final value = isQueued ? nextUpdate : Future.value(this._current);
  return timeout == null
      ? value
      : value.timeout(
          timeout,
          onTimeout:
              fallbackToCurrent == true ? (() => this._current!) : null,
        );
}