signInWithPhoneNumber method

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

Starts a sign-in flow for a phone number.

You can optionally provide a RecaptchaVerifier instance to control the reCAPTCHA widget appearance and behavior.

Once the reCAPTCHA verification has completed, called ConfirmationResult.confirm with the users SMS verification code to complete the authentication flow.

This method is only available on web based platforms.

Implementation

Future<ConfirmationResult> signInWithPhoneNumber(
  String phoneNumber, [
  RecaptchaVerifier? verifier,
]) async {
  assert(phoneNumber.isNotEmpty);
  // If we add a recaptcha to the page by creating a new instance, we must
  // also clear that instance before proceeding.
  bool mustClear = verifier == null;
  verifier ??= RecaptchaVerifier(auth: _delegate);
  final result =
      await _delegate.signInWithPhoneNumber(phoneNumber, verifier.delegate);
  if (mustClear) {
    verifier.clear();
  }
  return ConfirmationResult._(this, result);
}