Implementing FirebaseAuthStateListener using Shared Prefrences in Flutter. Hello ✌️, I started Flutter a month ago. I have built few small application in Flutter like , etc. I used for both the apps mentioned. One thing that I have realized while making blog application is about firebase auth state listener. In the flutter+firebase I didn’t find the Firebase Auth State listener as like in . (Auth state listener checks and continuously monitors the status of existence of the user and respectively shows the screen or activity in terms of Android) Chat Application Blog Application Firebase Android So in order get the current status of user and show the respective Scaffold or Material App or any respective component in Flutter, I used library in Flutter “Shared Prefrences” I have used Google Authenticatoin currently eith SharedPrefernce but one can use any of the Auth Method you want. In I have Declared 2 Scaffolds viz. loginScaffold and homeScaffold. and Changed them with respect to Auth State.If user already Logged in then showing homeScaffold else showing loginScaffold. After that if Login happens successfully loginScaffold will be replaced by the homeScaffold. Flutter Blog App Steps touse Shared Preference for Auth State Listening: 1. Adding Library to pubspec.yaml and importing in HomePage.dart flutter dependencies:flutter:sdk: ^0.1.0 cupertino_icons: shared_preferences: "^0.4.0"... Then importing into HomePage.dart as import ‘package:shared_preferences/shared_preferences.dart’; 2. Create Instance of Shared Prefernce and checking Existance of value in same : For the main screen I have used a material app whose “home :” attribute depends on current status of user that means if user is logged in it will show the homeScaffold and if not then will show loginScaffold.As Follows: (Code is Self Explantory :) ) HomePage StatefulWidget {@overrideHomePageState createState() => HomePageState();} class extends new HomePageState State<HomePage> {bool = ; // this will check status class extends loggedIn false Future<Null> _function() { async /\*\* This Function will be called every single time when application is opened and it will check if the value inside Shared Preference exist or not \*\*/ SharedPreferences prefs; prefs = **await** SharedPreferences._getInstance_(); **this**.setState(() { **if** (prefs.getString(**"username"**) != **null**) { **loggedIn** \= **true**; } **else** { **loggedIn** \= **false**; } }); }. . . . Scaffold homeScaffold = /*define as required*/;Scaffold loginScaffold = /*define as required*/; @overrideWidget build(BuildContext context) { MaterialApp(title: ,home: ? homeScaffold : loginScaffold);}.... return new "SimpleBlogApp" loggedIn @override initState() { .initState(); ._function();....}} void super this 3. When sign in is clicked _ensureLoggedIn() function/method will be called and if it is successful then storing their User ID, User Name, User Profile Image and User emailid inside the Shared preference and making variable true: loggedIn Future<Null> _ensureLoggedIn() { async SharedPreferences prefs;prefs = SharedPreferences. (); await getInstance ........ //sign in the user here and if it is successful then do following prefs.setString( , user. );prefs.setString( , user. );prefs.setString( , user. );prefs.setString( , user. ); .setState(() {/*updating the value of so it willautomatically trigger the screen to display homeScaffold.*/ = ; });} "username" displayName "userid" id "useremail" email "userphotourl" photoUrl this loggedIn to true loggedIn true ...... 5. When user signs out clearing the Shared preference as: Future<Null> logoutUser() { SharedPreferences prefs;prefs = SharedPreferences. (); googleSignIn.signOut();prefs.clear();prefs.commit(); .setState(() {/*updating the value of so it willautomatically trigger the screen to display loginScaffold.*/ = ;});} async //logout user await getInstance await this loggedIn to false loggedIn false You can check the file inside project on the GitHub. The code is taken from that file only. HomePage.dart Flutter blog app For more Flutter project by me take a look at my . GitHub Profile Happy Coding 😍Thanks✌️🙂