Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import 'LogIn.dart';
import 'package:flutter/material.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'HomePage.dart';
class IntroScreen extends StatefulWidget {
_IntroScreenState createState() => _IntroScreenState();
class _IntroScreenState extends State<IntroScreen> {
final FirebaseAuth auth = FirebaseAuth.instance;
Widget build(BuildContext context) {
return StreamBuilder<User>(
stream: auth.authStateChanges(),
builder: (context, snapshot) {
if (snapshot.connectionState == {
User user =;
if (user == null) {
return LogIn();
return HomePage();
} else if (snapshot.connectionState == ConnectionState.waiting) {
return Scaffold(
body: Center(
child: CircularProgressIndicator(),
return null;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment