[Firebase_auth] Null check operator used on a null value #5770
Unanswered
iampapagray
asked this question in
Q&A
Replies: 1 comment
-
I have made some modifications to the function above.
And though the function prints the uid of the user I get this error:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
I have the function below for verifying the OTP sent the mobile number whiles using the
verifyPhoneNumber()
on the FirebaseAuth instance.Future<User?> manualVerification(code) async { try { await _firebaseAuth .signInWithCredential(PhoneAuthProvider.credential( verificationId: _verificationCode, smsCode: code, )) .then((value) async { if (value.user != null) { print("User not null"); print("user ${value.user}"); return value.user; } else { print("User null!"); } }).catchError((err) { print("manual verification Failed: $err"); return err; }); } catch (e) { print("manualVerification Catch| $e"); } }
However, Once the function is called and completes, I get "User not Null" in the console as expected.
But I also get "Null check operator used on a null value" and "type '_CastError' is not a subtype of type 'FutureOr<User?>'".
Also the function return null for
Value.user
. but also when I check the Firebase console the user has been created.I have tried the same code with firebase_auth: ^1.0.3 and ^1.1.0
Please help
Beta Was this translation helpful? Give feedback.
All reactions