User Authentication (Google) Sign in to the application with Google This lesson is available for PRO members or as a single course purchase. Sign-in and choose a plan below. *Enrollment provides full access to this course (and updates) for life. Or Signup for Unlimited PRO Access 📼 Login to Watch 👈 Loading Indicator User Profile 👉 Note: If you experience issues with Google Auth, revisit the Firebase Setup section to ensure the SHA fingerprint has been setup on your local machine. Auth Service Create an auth service to isolate the business logic for Firebase authentication methods and user management. file_type_dartlang auth.dart import 'package:firebase_auth/firebase_auth.dart'; import 'package:google_sign_in/google_sign_in.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'dart:async'; class AuthService { final GoogleSignIn _googleSignIn = GoogleSignIn(); final FirebaseAuth _auth = FirebaseAuth.instance; final Firestore _db = Firestore.instance; // Firebase user one-time fetch Future<FirebaseUser> get getUser => _auth.currentUser(); // Firebase user a realtime stream Stream<FirebaseUser> get user => _auth.onAuthStateChanged; /// Sign in with Google Future<FirebaseUser> googleSignIn() async { try { GoogleSignInAccount googleSignInAccount = await _googleSignIn.signIn(); GoogleSignInAuthentication googleAuth = await googleSignInAccount.authentication; final AuthCredential credential = GoogleAuthProvider.getCredential( accessToken: googleAuth.accessToken, idToken: googleAuth.idToken, ); AuthResult result = await _auth.signInWithCredential(credential); FirebaseUser user = result.user; // Update user data updateUserData(user); return user; } catch (error) { print(error); return null; } } /// Anonymous Firebase login Future<FirebaseUser> anonLogin() async { AuthResult result = await _auth.signInAnonymously(); FirebaseUser user = result.user; updateUserData(user); return user; } /// Updates the User's data in Firestore on each new login Future<void> updateUserData(FirebaseUser user) { DocumentReference reportRef = _db.collection('reports').document(user.uid); return reportRef.setData({'uid': user.uid, 'lastActivity': DateTime.now()}, merge: true); } // Sign out Future<void> signOut() { return _auth.signOut(); } } Current User with Provider Access the current user with Provider. file_type_dartlang main.dart Widget build(BuildContext context) { return MultiProvider( providers: [ StreamProvider<FirebaseUser>.value(value: AuthService().user) ], child: MaterialApp( // omitted ) } Chapters Intro 👶 1 Resources How to be successful in this course free 1:42 👶 2 Flutter Overview What makes Flutter so Special? 3:20 👶 3 Installation and Setup Install Flutter and native IDEs 5:37 👶 4 Firebase setup Add Firebase to Flutter 3:15 👶 5 VS Code Maximize the power of your IDE for Flutter free 4:55 Widgets 🐦 6 Widgets Stateless vs Stateful 5:20 🐦 7 Platform Checking Material vs Cupertino Widgets 2:18 🐦 8 Material App & Scaffold High-level UI widgets 2:35 🐦 9 Single Widget Layout Align and position individual widgets 2:26 🐦 10 Box Decoration Make containers look awesome 2:09 🐦 11 Text Working with the Text widget 2:40 🐦 12 Gestures Detect user interaction within your app 2:13 🐦 13 Flex Layout Align widgets in rows and columns 2:48 🐦 14 Stack Position widgets on a Stack 1:44 🐦 15 Scroll ListView and GridView for scrollable widgets 3:04 🐦 16 Animated Widgets Use AnimatedContainer for automatic motion 2:42 Flutter Concepts 🎨 17 Themes Styles, Themes, and InheritedWidget 2:30 🚎 18 Navigation Screen routing with a navigation stack 3:57 🌊 19 Async Widgets Handle Streams and Futures 4:25 Let's Build an App 🎫 20 App Tour Take a closer look at the quiz app that we're building free 2:45 🌊 21 State Management Handle shared Firebase data with Provider 3:21 🍱 22 Project Organization How to structure a complex Flutter app 3:19 🚆 23 Routing & Firebase Analytics Configure Flutter screen routing for Firebase Analytics 2:03 🍫 24 Bottom Navigation Bar Create a shared bottom navigation bar 4:09 💫 25 Loading Indicator Show a loading indicator or loading screen 1:02 User Authentication 🔑 26 User Authentication (Google) Sign in to the application with Google 5:32 🐼 27 User Profile Display user data on the profile screen 1:43 💂 28 Login Screen Build a UI for multiple login methods 4:11 🍎 29 Sign In with Apple Sign in with Apple on Flutter & Firebase to comply with the latest iOS requirements free 4:28 Firestore 🔥 30 Basic Firestore Read and secure data with Firestore 4:21 💽 31 Database Model Firestore document structure for quizzes. 💥 32 Advanced Firestore Data Organization and Deserialization 7:01 💥 33 Current User Data in Firestore Connect a Firebase User to their Data in Firestore 2:20 Quiz UI 📳 34 Topics Screen Use GridView to list Firestore data 5:25 😎 35 Hero Animation Create beautiful transitions between screens the with the Hero widget 1:10 🖌️ 36 Animated Progress Bar Build an animated progress bar from scratch 3:16 ✔️ 37 Quiz State Management Advanced usage of the Provider package 2:08 ✔️ 38 Quiz PageView Advanced usage of the PageView widget 3:14 Release 🎉 39 Google Play Android release walkthrough 4:23 🎉 40 Apple App Store iOS release walkthrough 4:16