Created
October 12, 2021 12:49
-
-
Save guilhermecarvalhocarneiro/c40696d59c0bfcfc0f98c0533c5dfc5a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await FirebaseAuth.instance.verifyPhoneNumber( | |
phoneNumber: phoneNumber, | |
verificationCompleted: (PhoneAuthCredential credential) async { | |
// ! Este método não é chamado | |
print("*******************************************************************"); | |
print("Usuário registrado com sucesso"); | |
print(credential.toString()); | |
print("*******************************************************************"); | |
final userAuth = await firebaseAuth.signInWithCredential(credential); | |
if (userAuth != null) { | |
print("USUÁRIO AUTENTICADO APÓS CONCLUIR A VALIDAÇÃO DO LOGIN NO FIREBASE"); | |
_firebaseID = userAuth.user.uid; | |
print(_firebaseID); | |
} | |
}, | |
// Callback disparado quando ocorre algum erro no Firebase | |
verificationFailed: (FirebaseAuthException e) { | |
_showMessage("Ocorreu um erro ao tentar registrar a conta, por favor tente novamente.", error: true); | |
_hideLoadingModal(); | |
}, | |
// Callback chamado quando o Firebase retorna o código baseado no número informado pelo usuário | |
// deve ser utilizado para atualizar a tela seguindo as regras de negócio do projeto | |
codeSent: (String verificationID, int resendToken) { | |
// ! Este método é chamado corretamente | |
setState(() { | |
_inputCodeConfirmationOTP = true; | |
_verificationID = verificationID; | |
}); | |
}, | |
// Callback chamado quando o timeout informado abaixo expirar | |
codeAutoRetrievalTimeout: (String verificationID) { | |
DebugPrint.print("Verification ID: $verificationID"); | |
}, | |
timeout: Duration(seconds: 120)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment