We'll place the authentication logic in a new class. This class will contain four methods:
- A method to log in
- A method to sign up
- A method to log out
- A method to retrieve the current user
Let's begin adding our login, as follows:
- Create a new folder in the lib folder of our app and call it shared. Inside the shared folder, let's also create a new file called authentication.dart.
- In this file, we'll import the firebase_auth package and async.dart.
- Next, we'll create a new class called Authentication, as follows:
import 'dart:async';import 'package:firebase_auth/firebase_auth.dart';class Authentication {}
- In the Authentication class, we'll declare an instance of FirebaseAuth, which is the object that enables ...