signInWithPhone method
Implementation
Future<void> signInWithPhone(
final String phone,
Widget screenOTP,
Iwatting iwatting,
) async {
updateStatusButton();
iwatting.showWatting();
final String phoneNumber = Methods.preparePhone(phone);
Common.phoneNumberInput = phoneNumber;
if (phoneNumber == Common.fakeLoginPhone) {
await Get.to(() => screenOTP);
return;
}
await auth.verifyPhoneNumber(
phoneNumber: phoneNumber,
timeout: const Duration(seconds: 0),
verificationCompleted: (AuthCredential authCredential) async {},
verificationFailed: (FirebaseAuthException exception) {
handleExceptionAuth(exception, iwatting);
return;
},
codeSent: (String verificationId, int? forceResendingToken) {
iwatting.hideWatting();
if (verificationId == '') {
handleExceptionAuth(Exception('VerificationId is empty'), iwatting);
return;
}
iwatting.hideWatting();
//show screen otp
strVerificationId = verificationId;
Get.to(() => screenOTP);
},
codeAutoRetrievalTimeout: (String verificationId) {
iwatting.hideWatting();
strVerificationId = verificationId;
});
}