signInWithEmail function

Future<Map> signInWithEmail(
  1. String email,
  2. String password
)

Implementation

Future<Map> signInWithEmail(String email, String password) async {
  final authResult =
      await _auth.signInWithEmailAndPassword(email: email, password: password);
  final User? user = authResult.user;

  assert(user != null);
  assert(await user!.getIdToken() != null);
  final User? currentUser = _auth.currentUser;
  assert(user!.uid == currentUser!.uid);

  var userDetails = {
    "id": user!.uid,
    "name": user.displayName,
    "email": user.email,
    "image": user.photoURL,
    "lastSignin": user.metadata.lastSignInTime,
    "createdate": user.metadata.creationTime,
    "token": await user.getIdToken().then((value) => value)
  };

  return userDetails;
}