Beginning FlutterFire

Aug 30 2022 · Dart 2.16, Flutter 3.0, Visual Studio Code 1.69

Part 2: Add Authentication to Your App

05. Add a Sign-In Screen

Episode complete

Play next episode

Next
About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 04. Implement Firebase Authentication Next episode: 06. Add a Forgot Password Screen

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

OK, we are now ready to start using Firebase in our app.

import 'package:firebase_core/firebase_core.dart'; 
import 'firebase_options.dart'; 
WidgetsFlutterBinding.ensureInitialized(); 
Future<void> main() async { 
  WidgetsFlutterBinding.ensureInitialized(); 
  await Firebase.initializeApp( 
    options: DefaultFirebaseOptions.currentPlatform, 
  ); 
  runApp(const MyApp()); 
} 
import 'package:firebase_auth/firebase_auth.dart'; 
return StreamBuilder<User?>( 
      stream: FirebaseAuth.instance.authStateChanges(), 
      builder: (context, snapshot) { 
        return Container(); 
      }, 
flutter.minSdkVersion=21 
minSdkVersion localProperties.getProperty('flutter.minSdkVersion').toInteger() 
if (!snapshot.hasData) { 
  return SignInScreen(); 
} 
providerConfigs: [ 
  EmailProviderConfiguration(), 
], 
// User is not logged in 
        if (!snapshot.hasData) { 
          return const SignInScreen( 
            providerConfigs: [ 
              EmailProviderConfiguration(), 
            ], 
          ); 
        } 
        return const ActivitiesScreen();