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.0 APIs.
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