Flutter & Firebase authentication with streams and StreamBuilder

Опубликовано: 10 Октябрь 2024
на канале: Andrea Bizzotto
17,704
243

Sign up here for more videos: https://codewithandrea.com/

GitHub code for this project: https://github.com/bizz84/coding-with... (or to follow along step-by-step: https://github.com/bizz84/coding-with...)

This video is a continuation on my small series on how to build a login flow with Firebase.

In this video I show how to use a special stream called onAuthStateChanged, and use it to simplify our widgets logic.

This leads to a very elegant solution using StreamBuilder, which I highly recommend when using Firebase authentication.

HIGHLIGHTS
00:00 - Intro
00:37 - Getting the latest code from GitHub
01:41 - Overview of the project
03:14 - FirebaseAuth.onAuthStateChanged explained
06:19 - Updating the RootPage with StreamBuilder
09:31 - Removing all the old code
10:18 - Benefits of streams + StreamBuilder
13:07 - Summary & wrap up

This code was tested with Flutter stable 1.2.

Want more? Check out all my Flutter courses: 👇👇
https://codewithandrea.com/courses/

Thanks for watching!