title: After Signing In Not Navigating to main page
body: <p>i am following a tutorial from Youtube. when i go with the flow everything works fine but when i add my code it gives errors.
  when user is sign in for the first time after logout it stucks to the signin page and doesnot navigate to main page. but when we close and open app again it takes user to main page. please help me with this i googled it and i asked questions in fb groups but could not found a solution.
  here is my code.
  from auth.dart file</p>
  <pre><code>import 'package:cloud_firestore/cloud_firestore.dart';
  import 'package:firebase_auth/firebase_auth.dart';
  import 'package:twitter_clone/models/user.dart';
  
  class AuthService {
    FirebaseAuth auth = FirebaseAuth.instance;
  
    UserModel _userFromFirebaseUser(User user) {
      return user != null ? UserModel(id: user.uid) : null;
    }
  
    Stream&lt;UserModel&gt; get user {
      return auth.authStateChanges().map(_userFromFirebaseUser);
    }
  
    Future signUp(email, password) async {
      try {
        UserCredential user = await auth.createUserWithEmailAndPassword(
            email: email, password: password);
  
        await FirebaseFirestore.instance
            .collection('users')
            .doc(user.user.uid)
            .set({'name': email, 'email': email});
        _userFromFirebaseUser(user.user);
      } on FirebaseAuthException catch (e) {
        if (e.code == 'weak-password') {
          
          print('The password provided is too weak.');
        } else if (e.code == 'email-already-in-use') {
          print('The account already exists for that email.');
        }
      } catch (e) {
        print(e);
      }
    }
  
    Future signIn(email, password) async {
      try {
        User user = (await auth.signInWithEmailAndPassword(
            email: email, password: password)) as User;
  
        _userFromFirebaseUser(user);
      } on FirebaseAuthException catch (e) {
        print(e);
      } catch (e) {
        print(e);
      }
    }
  
    Future signOut() async {
      try {
        return await auth.signOut();
      } catch (e) {
        print(e.toString());
        return null;
      }
    }
  }
  
  </code></pre>
  <p>from Signin.dart file</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:flutter/services.dart';
  import 'package:twitter_clone/screens/auth/signup.dart';
  import 'package:twitter_clone/services/auth.dart';
  import 'package:twitter_clone/utilities/constants.dart';
  
  class SignIn extends StatefulWidget {
    SignIn({Key key}) : super(key: key);
    @override
    _SignInState createState() =&gt; _SignInState();
  }
  
  class _SignInState extends State&lt;SignIn&gt; {
    final AuthService _authService = AuthService();
    
    
    ///variables to store email and password
    String email = '';
    String password = '';
    bool _rememberMe = false;
   Widget _buildLoginBtn() {
      return Container(
        padding: EdgeInsets.symmetric(vertical: 25.0),
        width: double.infinity,
        child: ElevatedButton(
          // elevation: 5.0,
          onPressed:() 
           async =&gt; 
            {
             _authService.signIn(email, password)
            },
          // padding: EdgeInsets.all(15.0),
          // shape: RoundedRectangleBorder(
          //   borderRadius: BorderRadius.circular(30.0),
          // ),
          // color: Colors.white,
          child: Text(
            'LOGIN',
            style: TextStyle(
              color: Color(0xFF527DAA),
              letterSpacing: 1.5,
              fontSize: 18.0,
              fontWeight: FontWeight.bold,
              fontFamily: 'OpenSans',
            ),
          ),
        ),
      );
    }
  </code></pre>