firebase add login with cardentials code example

Example 1: user login for android studio using firebase

auth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(this, OnCompleteListener{ task ->
    if(task.isSuccessful){
        Toast.makeText(this, "Successfully Registered", Toast.LENGTH_LONG).show()
        val intent = Intent(this, MainActivity::class.java)
        startActivity(intent)
        finish()
    }else {
        Toast.makeText(this, "Registration Failed", Toast.LENGTH_LONG).show()
    }
})

Example 2: firebase auth

dependencies:
  firebase_auth: ^0.18.3+1

Example 3: firebase sign out

Future<Null> _signOut() async {
    await _auth.signOut();
    this.setState(() {
      isLoading = false;
    });
    Navigator.of(context).pushAndRemoveUntil(
        MaterialPageRoute(builder: (context) => MyApp()),
        (Route<dynamic> route) => false);
  }

Tags:

Php Example