Introduction to Riverpod 2.x
In this section we’ll explore the new Riverpod APIs, using our eCommerce app for reference.
Here’s what we will cover:
- New starter project + walkthrough of the code changes
- Riverpod Generator package: overview
- How to convert
Provider
andFutureProvider
to the new@riverpod
syntax - Using code generation to overcome the limitations of the
family
modifier - How to convert
StateNotifier
subclasses toAsyncNotifier
- How to check if an
AsyncNotifier
is mounted - How to write unit tests for
AsyncNotifier
subclasses
By the end, you’ll be able to make the most of Riverpod Generator and the most important Riverpod 2.x APIs.
What about Riverpod 3.0?
The code for this section was last updated to the syntax introduced in Riverpod 2.6.1. The videos are still showing the old syntax (only minor changes are needed).
Riverpod 3.0 was released in September 2025, introducing additional features and some breaking changes. To learn what’s changed, read: What’s new in Riverpod 3.0.
Resources
For a good high-level overview of what’s new in Riverpod 2.0, watch this video by Randal Schwartz
To learn the new APIs in-depth, read these articles from my site:
- Flutter Riverpod 2.0: The Ultimate Guide
- How to Auto-Generate your Providers with Flutter Riverpod Generator
- How to use Notifier and AsyncNotifier with the new Flutter Riverpod Generator
- How to Unit Test AsyncNotifier Subclasses with Riverpod 2.0 in Flutter
- How to write Flutter apps faster with Riverpod Lint & Riverpod Snippets