acknowledge method
The user checked or dismissed the note — record done so it never returns
(durably, across relaunch). Optimistically hides it first; a failed write
is non-fatal (the store setter never throws).
No identity fence is needed here: the optimistic state = done is
synchronous and the sole await is the write itself, so no session flip
can interleave BEFORE the write — a fence in front of it would be dead
code. Across the only flip path (delete → welcome → restore) the note card
is unmounted, so acknowledge() is never live on a stale identity; and the
shared (non-namespaced) key's cross-wallet clobber is structurally
unreachable under single-wallet package onboarding. Were an await ever
added before the write, THAT is where a fence would have to go.
Implementation
Future<void> acknowledge() async {
final store = ref.read(onboardingStoreProvider);
state = const AsyncData(DeepScanRestoreNoteState.done);
if (store == null) return;
await store.setDeepScanRestoreNoteState(DeepScanRestoreNoteState.done);
}