Provider Decision Guide
πΊοΈ Rapid Provider Selection Engine
Use this multi-tier visual decision tree to select the precise @riverpod provider annotation and signature for any feature in seconds.
1. Master Decision Tree
Step 1: Is your state Asynchronous (Future/Stream) or Synchronous?
ASYNC (Network / DB)
Step 2: Do users perform mutations (POST/PUT)?
- YES (Mutations + Async): Use
@riverpod class X extends _$X(AsyncNotifier) - NO (Read-only Future): Use
@riverpod Future<T> fn(Ref ref) - NO (Realtime Stream): Use
@riverpod Stream<T> fn(Ref ref)
SYNCHRONOUS
Step 2: Does state update via user actions?
- YES (Mutations + Sync): Use
@riverpod class X extends _$X(Notifier) - NO (Read-only Service/DI): Use
@riverpod T fn(Ref ref)(Pure Provider)
2. Real Feature Scenario Mapping
| Production Feature Requirement | Exact @riverpod Annotation | Generated Type |
|---|---|---|
Injecting Dio ApiClient instance |
@riverpod |
AutoDisposeProvider<Dio> |
| Listening to Firebase Auth user stream | @riverpod |
AutoDisposeStreamProvider<User?> |
Fetching backend profile with refresh() mutation |
@riverpod |
AutoDisposeAsyncNotifierProvider |
| Fetching item detail by ID parameter | @riverpod |
AutoDisposeFutureProviderFamily |