resend method

Future<ResendOutcome> resend({
  1. required AuthRestClient auth,
  2. required String email,
  3. required String password,
})

Implementation

Future<ResendOutcome> resend({
  required AuthRestClient auth,
  required String email,
  required String password,
}) async {
  final SignInResult signIn;
  try {
    signIn = await auth.signInWithPassword(email, password);
  } on AuthRestException catch (e) {
    throw _mapResendSignInFailure(e);
  }

  try {
    final verified = await auth.lookup(signIn.idToken);
    if (verified) return ResendOutcome.alreadyVerified;

    await auth.sendVerificationEmail(signIn.idToken);
    return ResendOutcome.sent;
  } on AuthRestException catch (e) {
    throw _mapResendSignInFailure(e);
  }
}