In this recipe, you will add authentication with a username and password, and you will allow users to sign up and sign in. Perform the following steps:
-
From the Firebase console, get to the Authentication option inside the Build section of the Project's dashboard and click on the Get Started button.
-
Click on the Sign-in method tab.
-
Enable the Email/Password authentication method.
-
Get back to your Flutter project, and create a new file in the lib folder and call it login_screen.dart.
- At the top of the login_screen.dart file, import the material.dart library:
import 'package:flutter/material.dart';
- Create a new stateful widget using the stful shortcut and call it LoginScreen.
- At the top of the _LoginScreenState class, add the following variables:
String _message = '';
bool _isLogin = true;
final TextEditingController txtUserName = TextEditingController();
final TextEditingController txtPassword = TextEditingController();
- Create a method...