sendOtp method

  1. @override
Future<AuthResult<void>> sendOtp(
  1. String contact,
  2. AuthMethod method
)
override

Implementation

@override
Future<AuthResult<void>> sendOtp(String contact, AuthMethod method) async {
  try {
    if (method == AuthMethod.phone) {
      await _auth.signInWithPhoneNumber(contact);
    } else {
      final user = _auth.currentUser;
      if (user != null) {
        await user.sendEmailVerification();
      }
    }
    return const AuthResult.success(null);
  } on fb.FirebaseAuthException catch (e) {
    return AuthResult.failure(AuthException.fromFirebase(e));
  }
}