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:

Authentication flows

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, and ref.listen using Riverpod
  • Catching errors with try/catch vs AsyncValue.guard
  • Creating immutable state classes with final properties
  • Generation of copyWith, toString, ==, hashCode using 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.

Questions? Let's chat