Lesson 38: Login App with Firebase

Create a login screen connected to Firebase Authentication.


TextField(
  decoration: InputDecoration(labelText: 'Email'),
),
TextField(
  decoration: InputDecoration(labelText: 'Password'),
  obscureText: true,
),
ElevatedButton(
  onPressed: () async {
    try {
      await FirebaseAuth.instance.signInWithEmailAndPassword(
        email: emailController.text,
        password: passwordController.text,
      );
    } catch (e) {
      print(e);
    }
  },
  child: Text('Login'),
)
    
Previous Next Lesson