Section intro
In this section we’ll continue to work with the Riverpod package and implementing the authentication flows in the app (sign out, sign in with email & password), as shown in this diagram:
Here’s what we will cover:
- Implement an authentication repository, which will use a reactive in-memory database to store information about the authenticated user (using RxDart)
- Learn to create your own controller classes based on
StateNotifier - Use controllers to manage the widget state and communicate with the repositories in the data layer
- Listening to state changes inside the widgets
- Difference between
ref.watch,ref.readandref.listenusing Riverpod - Catching errors with
try/catchvsAsyncValue.guard - Creating immutable state classes with
finalproperties - Generation of
copyWith,toString,==,hashCodeusing the Dart Data Class Generator extension - Email & password sign in with a custom controller and state class
- Using
select()to partially listen to a provider - How to implement a redirect and refresh listenable with GoRouter & Riverpod
By the end of this section, you’ll be familiar with all the most useful Riverpod APIs.