title: How to show Valid or Invalid Snackbar when user enters the credential in Flutter?
body: <p>When the user enter wrong credentials the snackbar should show Login Failed and when right page should show successfully logged in snackbar.
  I have used firebase to authentication.</p>
  
  <pre><code>  final _formKey = GlobalKey&lt;FormState&gt;();
    TextEditingController _emailLoginFormTextEditingController = new TextEditingController();
    TextEditingController _passwordLoginFormTextEditingController = new TextEditingController();
  
    void initState() {
      super.initState();
    }
  
    _signInUsingFirebase(String email, String password) {
      FirebaseAuth firebaseAuth = FirebaseAuth.instance;
      firebaseAuth.signInWithEmailAndPassword(email: email, password: password)
          .then((AuthResult authResult) {
        FirebaseUser user = authResult.user;
        Navigator.of(context).push(MaterialPageRoute(
          builder: (context) =&gt; HomePage(email: email, userid: user.uid,),
        ));
      }).catchError((error) {
        debugPrint(error);
      });
    }
  
    Widget _loginPageSaffoldBody(BuildContext context) {
      return Form(
        key: _formKey,
        child: ListView(
          padding: EdgeInsets.all(32),
          children: &lt;Widget&gt;[
            TextFormField(
              controller: _emailLoginFormTextEditingController,
            ),
            TextFormField(
              controller: _passwordLoginFormTextEditingController,
            ),
            RaisedButton(
              onPressed: () {
                // If statement is validating the input fields.
                if (_formKey.currentState.validate()) {
                  _signInUsingFirebase(_emailLoginFormTextEditingController.text,
                      _passwordLoginFormTextEditingController.text);
                  Scaffold.of(context).showSnackBar(                          //Snackbar for Succesfull
                    SnackBar(
                      content: Text(
                        "Succesfull",
                      ),
                    ),
                  );
                }
                else{
                  Scaffold.of(context).showSnackBar(                        //Snackbar for unsuccesfull
                    SnackBar(
                      content: Text(
                        "Unsuccesfull",
                      ),
                    ),
                  );
                }
              },
              child: Row(
                mainAxisSize: MainAxisSize.min,
                children: &lt;Widget&gt;[
                  Icon(
                    Icons.lock_open,
                  ),
                  SizedBox(width: 4),
                  Text(
                    "Submit",
                  ),
                ],
              ),
            ), // Submit Button
          ],
        ),
      );
    }
  </code></pre>
  
  <p>A little out of context question I also want to keep user logged in once they enter the credentials till they login in i want to use shared preference but unable to understand how if u can provide any link might help 
  Thank You !</p>