loginAsync method

Future<void> loginAsync(
  1. String email,
  2. String password,
  3. Function onLoginSuccess
)

Implementation

Future<void> loginAsync(
    String email, String password, Function onLoginSuccess) async {
  var result = await _auth.signInWithEmailAndPassword(
    email: email,
    password: password,
  );
  final User? user = result.user;

  final User currentUser = _auth.currentUser!;
  assert(user!.uid == currentUser.uid);

  if (user != null) {
    _user = user;
    var idToken = await user.getIdTokenResult(false);
    _accessToken = idToken.token;
    _expiryDate = idToken.expirationTime;
    _isLogout = false;
    await onLoginSuccess();
    notifyListeners();
  }
}