signingWithPhoneSendCode method
Future<void>
signingWithPhoneSendCode(
{ - required String phoneNumber,
- required dynamic codeSent(
- String?,
- int?
),
- required dynamic callback(),
- required dynamic callbackError(),
})
Implementation
Future<void> signingWithPhoneSendCode(
{required String phoneNumber,
required Function(String?, int?) codeSent,
required Function() callback,
required Function() callbackError}) async {
_resetState();
if (!ExaAuthUtils.validateMobile(
phoneNumber.replaceAll(RegExp(r'\D'), ''))) {
currentError.value = AuthFailure(
type: FailureType.invalidPhone, sigInType: SigInType.phone);
_stopLoad();
callbackError.call();
return;
}
await signInWithPhoneUseCase.call(
phoneNumber: '+55${phoneNumber.replaceAll(RegExp(r'\D'), '')}',
verificationCompleted: (r) {
_stopLoad();
//todo successSignIn
callback.call();
},
verificationFail: (l) {
_stopLoad();
currentError.value = l;
callbackError.call();
},
codeSent: (verificationToken, code) {
_stopLoad();
codeSent.call(verificationToken, code);
});
}