signInWithPhoneNumber method

Future<ConfirmationResult> signInWithPhoneNumber(
  1. String phoneNumber, [
  2. RecaptchaVerifier? verifier
])

Starts a phone number verification process for the given phone number.

This method is used to verify that the user-provided phone number belongs to the user. Firebase sends a code via SMS message to the phone number, where you must then prompt the user to enter the code. The code can be combined with the verification ID to create a PhoneAuthProvider.credential which you can then use to sign the user in, or link with their account ( see signInWithCredential or User.linkWithCredential).

Implementation

Future<ConfirmationResult> signInWithPhoneNumber(String phoneNumber,
    [RecaptchaVerifier? verifier]) async {
  try {
    final verificationId = await _api.smsAuth.signInWithPhoneNumber(
      phoneNumber,
      verifier: verifier,
    );
    return ConfirmationResult(this, verificationId);
  } catch (e) {
    rethrow;
  }
}