我有一个问题,我无法解决。
在我点击验证按钮(第二个 img)后,它返回第一张照片,就是这样,就像 navigator.pop() 函数。
我有提供电话号码登录的功能,在这里:
Future<void> signInWithTelephoneNumber({String phoneNumber}) async {
emit(state.copyWith(phoneNumber: phoneNumber,isInProgress: true, errorMessage: ""));
await FirebaseAuth.instance.verifyPhoneNumber(
phoneNumber: "+9$phoneNumber",
timeout: const Duration(seconds: 30),
verificationCompleted: (PhoneAuthCredential credential) async {
await FirebaseAuth.instance.signInWithCredential(credential);
print("Successsssssssssssssssssss");
},
verificationFailed: (FirebaseAuthException e) {
if (e.code == 'invalid-phone-number') {
print('The provided phone number is not valid.');
emit(state.copyWith(errorMessage: "The provided phone number is not valid."));
}
},
codeSent: (String verificationId, int resendToken) async {
String smsCode = '123456';
PhoneAuthCredential credential = PhoneAuthProvider.credential(
verificationId: verificationId, smsCode: smsCode);
await FirebaseAuth.instance.signInWithCredential(credential);
},
codeAutoRetrievalTimeout: (String verificationId) {},
);
emit(state.copyWith(phoneNumber: "",isInProgress: false, errorMessage: ""));
}
当我点击登录按钮时,它进入验证页面(chapcta页面),在我验证图像后,它给出了这个错误:
Notifying id token listeners about user ( RID5Hq65CCcj1hXgyvVosA6QKbo1 ).
D/FirebaseAuth( 2708): Notifying auth state listeners about user ( RID5Hq65CCcj1hXgyvVosA6QKbo1 ).
E/flutter ( 2708): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: Null check operator used on a null value
我该怎么办?我怎么解决这个问题 ?我使用此链接作为来源:https://firebase.flutter.dev/docs/auth/phone/
答案 0 :(得分:0)
我使用了 showDialog 并为短信代码提供了输入。谢谢