Flutter Riverpod 2.0 Advanced — Notifier, AsyncNotifier, Family, and AutoDispose
Riverpod 2.0 introduced Notifier and AsyncNotifier as the modern replacement for StateNotifier . This article covers advanced usage patterns for indie Flutter developers building production-grade apps with Supabase.
Notifier vs AsyncNotifier
Notifier<T> handles synchronous state — use it when state transitions resolve immediately without async operations.
// Synchronous state management @riverpod class CounterNotifier extends _$CounterNotifier { @override int build () = > 0 ;
void increment () = > state ++ ; void reset () = > state = 0 ; }
Enter fullscreen mode
Exit fullscreen mode
AsyncNotifier<T> manages state that depends on asynchronous data sources — ideal for API calls or database access.
// Async state management with Supabase @riverpod class UserProfileNotifier extends _$UserProfileNotifier { @override Future < UserProfile > build () async { final userId = ref .…