Flutter Firebase Authentication - The Clean Way

Robert Brunhage · 134K views · 2020 · 7:42

Open on YouTube

Software practice, open source & careersWeb developmenttutorialdated

Why Stack Overflow recommends it

Stack Overflow users cite it as the tutorial they followed for Flutter Firebase auth when asking why Provider errors or post-login navigation are not working.

Recommended by 1 people across 1 different months, 2021 to 2021.

What it is

A short Flutter tutorial by Robert Brunhage that builds email and password Firebase Authentication using Provider, an authentication service class and an authentication wrapper widget. It covers setup, sign in and sign out pages, conditional page display and a unit test, with source code on GitHub.

What people said

Recommends mArty · 2021-09 · Stack Overflow · on “Firestore Multiprovider doesn't work for authentication”

I am currently following this tutorial : [this video] , but I get an error of Provider (I think) when I try to run it. I am getting almost the same main page except for the homePage() and signInPage() that are my own pages. import 'package:firebase_auth/firebase_auth.dart'; import 'package:flutter/material.dart'; import 'package:fyzik_flutter/views/authenticate/authentication_service.dart'; import 'package:provider/provider.dart'; import 'package:fyzik_flutter/views/authenticate/signup.dart'; import 'package:fyzik_flutter/views/tabs.dart'; import 'package:firebase_core/firebase_core.dart'; Future<void> main() async { WidgetsFlutterBinding.ensureInitialized(); await Firebase.initializeApp(); //set

Cites Kondos · 2021-01 · Stack Overflow · on “Unable to navigate to homepage after register with firebase Flutter”

Im trying to navigate to homepage after login, this works, i followed this one tutorial: [this video] But, my problem is when i go to register button > register an user and it takes me straight to the login page but when I fill in the login forms and log in, nothing happens, i must to do a "hot restart" to see my homepage, it is as if some widget did not rebuild. So i should do any better clean way to do this statemanagement? Main: import 'package:firebase_auth/firebase_auth.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; import 'package:plantsapp/screens/login_page.dart'; import 'package:plantsapp/screens/plant_screen.dart'; import 'package:plant

Cites user10286245 · 2021-04 · Stack Overflow · on “How to be automatically redirect after firebase login?”

I followed this tutorial [this video] for implement firebase auth to my app. All is working great except one thing. When i'm in the login screen and click on the login button, i have to restart the app to access the homepage. That's doesn't happen when i click logout, i'm redirect to login instantly. Here is my sign in: Future<String> signIn({String email, String password}) async { try { await _firebaseAuth.signInWithEmailAndPassword( email: email, password: password); return "Connecté"; } on FirebaseAuthException catch (e) { return e.message; } } main.dart class AuthenticationWrapper extends StatelessWidget { const AuthenticationWrapper({ Key key, }) : super(key: key); @override Widget build(Bui