build method
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
WalletActivityState build() {
_disposed = false;
ref.onDispose(() => _disposed = true);
final session = ref.watch(walletSessionProvider);
if (session == null) {
// No wallet — the screen renders the not-set-up state and does not watch
// this. A neutral loading is the honest value.
return const WalletActivityState();
}
// A fresh (re)build (e.g. the rescan session swap) supersedes any in-flight
// continuation captured before it — they see a stale generation and no-op.
final gen = ++_generation;
unawaited(_loadFirst(session, gen));
return const WalletActivityState(phase: WalletActivityPhase.loading);
}