Need example or solution idea about GetMiddleware implementation with FirebaseAuth #2312
Unanswered
furatamasensei
asked this question in
Q&A
Replies: 1 comment
-
|
This works for with hot reload, as the user seems to be re-registered at some point and is not NULL. sub = _firebaseAuth.authStateChanges().listen((User? user) {
if (user != null) {
Get.offNamed( YOUR_ROUTE );
}
}); |
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.
-
Hi guys! I need help with auth middleware implementation using
firebase_auth. I have tried so many attempts but none is working. The problem with my current implementation is that the user is redirecting to the login page everytime the app is reopened or the browser was refreshed.My current middleware implementation looks like this, and what I know is the
currentUseris always giving me anullresult on page load.auth_middleware.dartapp_pages.dartI once tried to use
GetxServicebut it sometimes throws anavigation without contexterror when I tried to run the app.The
usergetter is also always giving menull. What I really get from this method is this happening because theauthStateChangesstream is triggering theeverworker, eventhough the value is the same (null). I am wondering if I could do something to make theeverworker not triggering in at the very first time the stream is binded. Can we do that?auth_service.dartauth_middleware.dartmain.dartI really appreciate any kind of help from the community! ><
Beta Was this translation helpful? Give feedback.
All reactions