verifyPhoneNumber method
- String? phoneNumber,
- PhoneMultiFactorInfo? multiFactorInfo,
- required PhoneVerificationCompleted verificationCompleted,
- required PhoneVerificationFailed verificationFailed,
- required PhoneCodeSent codeSent,
- required PhoneCodeAutoRetrievalTimeout codeAutoRetrievalTimeout,
- Duration timeout = const Duration(seconds: 30),
- int? forceResendingToken,
- MultiFactorSession? multiFactorSession,
- @visibleForTesting String? autoRetrievedSmsCodeForTesting,
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 linkWithCredential
).
On some Android devices, auto-verification can be handled by the device and a PhoneAuthCredential will be automatically provided.
No duplicated SMS will be sent out unless a forceResendingToken
is
provided.
phoneNumber
The phone number for the account the user is signing up
for or signing into. Make sure to pass in a phone number with country
code prefixed with plus sign ('+').
timeout
The maximum amount of time you are willing to wait for SMS
auto-retrieval to be completed by the library. Maximum allowed value
is 2 minutes.
forceResendingToken
The forceResendingToken
obtained from codeSent
callback to force re-sending another verification SMS before the
auto-retrieval timeout.
verificationCompleted
Triggered when an SMS is auto-retrieved or the
phone number has been instantly verified. The callback will receive an
PhoneAuthCredential that can be passed to signInWithCredential or
linkWithCredential
.
verificationFailed
Triggered when an error occurred during phone number
verification. A FirebaseAuthException is provided when this is
triggered.
codeSent
Triggered when an SMS has been sent to the users phone,
and will include a verificationId
and forceResendingToken
.
codeAutoRetrievalTimeout
Triggered when SMS auto-retrieval times out and
provide a verificationId
.
Implementation
Future<void> verifyPhoneNumber({
String? phoneNumber,
PhoneMultiFactorInfo? multiFactorInfo,
required PhoneVerificationCompleted verificationCompleted,
required PhoneVerificationFailed verificationFailed,
required PhoneCodeSent codeSent,
required PhoneCodeAutoRetrievalTimeout codeAutoRetrievalTimeout,
Duration timeout = const Duration(seconds: 30),
int? forceResendingToken,
MultiFactorSession? multiFactorSession,
// ignore: invalid_use_of_visible_for_testing_member
@visibleForTesting String? autoRetrievedSmsCodeForTesting,
}) {
throw UnimplementedError('verifyPhoneNumber() is not implemented');
}