What this thread does
Do first: watch one keyed FutureProvider or AsyncNotifierProvider as an AsyncValue and connect refresh completion to ref.refresh(breweryProvider.future).
Short answer
As of November 2026, this recipe pins flutter_riverpod 3.4.3, released September 4. Model first loading, error, data and refresh with the provider's AsyncValue instead of independent booleans. Preserve prior data only for the intended request key; retry and cache lifetime are explicit policies.
Choose / don't choose
- FutureProvider: choose for an asynchronous read derived from inputs; don't put user-triggered writes inside repeated read computation.
- AsyncNotifierProvider: choose for FutureProvider-like state that can also be modified from the UI; don't duplicate its state in a second widget cache (provider contract).
- Fine-tuned retention: choose ref.keepAlive after enabling automatic disposal (disposal).
Not for: state-library or router selection; see riverpod-bloc-provider-signals-and-routing-for-a-flutter-app.
Settings that matter
| Setting or flag | Value / default | Applies to | Source |
|---|---|---|---|
isAutoDispose | true to enable automatic disposal when manually creating a provider; plain FutureProvider default false; generated providers auto-dispose by default | Pinned provider / current disposal guide | constructor, guide |
ref.keepAlive() | Call after enabling automatic disposal; retain its link and close it when retention should end | Current provider lifetime | disposal, mounted |
when.skipLoadingOnRefresh | true default: controls whether loading is invoked on forced refresh | Pinned AsyncValue implementation | source |
when.skipLoadingOnReload | false default: controls whether loading is invoked when a provider rebuilds because of Ref.watch; true only for an intentional stale-content policy | Pinned AsyncValue implementation | source |
when.skipError | false default; true may keep previous data after an error, so expose a separate error/retry indication | Pinned AsyncValue implementation | source |
retry | (retryCount, error) => null to disable automatic retry; a Duration schedules retry | Current retry policy | retry |
RefreshIndicator.onRefresh | Return/await ref.refresh(breweryProvider.future), not a void invalidation | Current refresh recipe | Riverpod |
ListView.physics | const AlwaysScrollableScrollPhysics() for short/empty content | Current Flutter RefreshIndicator | Flutter |
Provider names and filter parameters above are application placeholders. A family key must have stable equality/hashCode; don't allocate an identity-based list key on every build (family).
Order of operations
1. Capture the provider's input key and watch that exact family instance. First load without previous data shows a full loading state; data renders the list or a real empty view; error offers an explicit Retry action. 2. Keep a read provider auto-disposable, await its request, then call keepAlive only if the Ref is still mounted and the result succeeded. Register cancellation/cleanup for the owning request; do not retain failed requests by accident. Recomputed state is disposed regardless of keepAlive policy. 3. For pull-to-refresh capture the current family instance in the event handler, call ref.refresh(instance.future), and await it. Refresh is invalidate followed by read; alternatively invalidate(instance) and await ref.read(instance.future) (Refs). 4. Keep the previous list during a same-key refresh. For a dependency reload retain skipLoadingOnReload false when old account/filter data would be misleading. Switching family arguments selects a distinct state rather than making the old argument a valid new result. 5. On Retry invalidate the exact currently watched instance. If an old error remains, check the argument, scope/override and whether the UI is watching rather than merely reading. To reset every family key, invalidate the family itself; on logout clear retained account-derived state (family, invalidation). 6. For mutations expose AsyncNotifier methods and choose pessimistic reload or explicit optimistic state/rollback. Keep read build logic free of repeatable write side effects; refresh the affected read only after a successful write. 7. Exercise initial success/error/empty, data → refresh → success, data → refresh → error, filter/account change, retry and navigate away/back. Await the replacement request, assert the intended stale-data visibility, and confirm a completed old-key read never appears as the new key's rows.
the guide allows up to 10 retries with backoff from 200 ms to 6.4 seconds. Choose manual retry explicitly when that is the desired interaction (retry).
Known failures and fixes
| Error (short quote) | Cause | Fix | Source |
|---|---|---|---|
also triggers a reload | The report, closed as completed on 2026-11-15, says refresh also triggers a reload, making skipLoadingOnRefresh ineffective | Inspect dependency changes and actual AsyncValue flags; set both skip policies deliberately, and do not infer a current defect solely from that report | January 23 report, pinned behavior |
Refresh indicator does not show up | RefreshIndicator appears if its scrollable descendant can be overscrolled | Use a vertical scroll view and AlwaysScrollableScrollPhysics; return the request future to control completion | Flutter troubleshooting |
The first row is a reported symptom, not an exception string. Close the keepAlive link to restore auto-dispose; use ref.invalidate to force state destruction; unused parameter combinations need a bounded retention policy (provider lifetime).
Missing
- The linked source does not confirm: don't treat retention as disk persistence or freshness forever
- The linked source does not confirm: Default automatic retries can delay a final error view
- Actual filter equality, HTTP cancellation and cache TTL are application choices. Retaining successful state indefinitely across many keys can grow memory; persistent/offline conflict handling is outside this screen recipe.
Checked
2026-11-12; package changelog, pinned provider/AsyncValue source, disposal/family/Refs/retry/refresh/lifecycle guides, Flutter reference and dated report read. No Flutter provider or widget suite executed.
Started from a post by @Remi Rousselet, packaged by the editor. Original post