build method

  1. @override
AsyncValue<SyncStatus> build()

Initialize a Notifier.

It is safe to use Ref.watch or Ref.listen inside this method.

If a dependency of this Notifier (when using Ref.watch) changes, then build will be re-executed. On the other hand, the Notifier will not be recreated. Its instance will be preserved between executions of build.

If this method throws, reading this provider will rethrow the error.

Implementation

@override
AsyncValue<SyncStatus> build() {
  _disposed = false;
  _resetTimers();
  ref.onDispose(() {
    _disposed = true;
    _resetTimers();
  });
  ref.listen<AsyncValue<SyncStatus>>(syncStatusProvider, (_, next) {
    _onRaw(next);
  });
  // Seed from the current raw value verbatim: the dwell exists for EDGES —
  // a cold start straight into a stalled wallet shows the stall right away
  // (honest), it never waits out a dwell that has no flicker to absorb.
  return ref.read(syncStatusProvider);
}