Steps how I implemented.
As advised, I implemented all the way. It was quite good in debug mode. Unfortunately its not working in release mode even I added my debug and release sha1 keys in firebase console.
Step 1. Coding part is here
final PhoneVerificationCompleted verificationCompleted =
(PhoneAuthCredential user) {
successMessage('Your phone number verified successfully!');
_loginNotifier.validate();
};
final PhoneVerificationFailed verificationFailed = (FirebaseAuthException authException) {
errorMessage('Phone number verification failed. Code: ${authException.code}. Message: ${authException.message}');
print(
'Phone number verification failed. Code: ${authException.code}. Message: ${authException.message}');
};
final PhoneCodeAutoRetrievalTimeout codeAutoRetrievalTimeout =
(String verificationId) {
this._verificationId = verificationId;
print("time out");
};
firebaseAuth = FirebaseAuth.instance;
firebaseAuth.verifyPhoneNumber(
phoneNumber: '+$_phoneWithCC',
timeout: const Duration(seconds: 60),
verificationCompleted: verificationCompleted,
verificationFailed: verificationFailed,
codeSent: codeSent,
codeAutoRetrievalTimeout: codeAutoRetrievalTimeout);
Added all three different sha1 keys but still not working:(
Error I am getting:
As I said, in debug mode all good as expected But in release mode, after initiating the otp function, immediately PhineVerificationFailed with null message and null code.
If still anything I missed please advice. Thanks all