-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Open
Labels
platform: windowsIssues / PRs which are specifically for Windows.Issues / PRs which are specifically for Windows.plugin: authtype: bugSomething isn't workingSomething isn't working
Description
Bug report
Describe the bug
FirebaseAuth.instance.currentUser is always null when initializing firebase on windows, even if the user is logged in. It then changes to a non-null value within a few seconds.
Steps to reproduce
Steps to reproduce the behavior:
- Login with FirebaseAuth on flutter windows
- restart app and print FirebaseAuth.instance.currentUser immediately after initializing firebase
- See that the value is null initially, and then changes after about 20 seconds
Expected behavior
I expect the logged in user object to be shown on initialization, otherwise I have to add a delay (not sure how long it needs to be) or I don't know whether to show the login page or not. On mac and web, currentUser is immediately loaded on initialization.
Flutter doctor
Run flutter doctor
and paste the output below:
Click To Expand
PS C:\Users\justinmulli\blazesql_flutter> flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.16.4, on Microsoft Windows [Version 10.0.17763.5122], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[X] Android toolchain - develop for Android devices
X Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.2)
[!] Android Studio (not installed)
[√] VS Code (version 1.85.1)
[√] Connected device (3 available)
[√] Network resources
! Doctor found issues in 2 categories.
PS C:\Users\justinmulli\blazesql_flutter>```
---
richard457, SaadArdati, Skyost, chaudharydeepanshu, movaid7 and 4 more
Metadata
Metadata
Assignees
Labels
platform: windowsIssues / PRs which are specifically for Windows.Issues / PRs which are specifically for Windows.plugin: authtype: bugSomething isn't workingSomething isn't working
Activity
[-]🐛 [firebase_auth] FirebaseAuth.instance.currentUser initially null after initializing firebase on windows, even for logged in users[/-][+]🐛 [firebase_auth] FirebaseAuth.instance.currentUser initially null for the first few seconds initializing firebase on windows[/+]danagbemava-nc commentedon Dec 19, 2023
Hi @Justus-M, is this limited to only windows or do you experience it on other platforms as well?
Can you share the code sample you use as well?
Justus-M commentedon Dec 23, 2023
I haven't had time to create a minimum reproducible example but I imagine you can just use the example app and print FirebaseAuth.instance.currentUser immediately after initializing firebase.
I have added a delay of a few seconds and then it is no longer null, so to be honest this is no longer a priority for me. I believe it's an issue with the library so I wanted to bring it to your attention since flutterfire is still in the early stages for windows and has various issues.
But the code is literally just
print(FirebaseAuth.instance.currentUser)
This prints null on windows after initializing firebase, even if the user was logged in before closing the app.
On mac, web, and mobile it does not return null
google-oss-bot commentedon Jan 2, 2024
Hey @Justus-M. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.
If you have more information that will help us get to the bottom of this, just add a comment!
Justus-M commentedon Jan 2, 2024
I provided more information
35 remaining items