-
Notifications
You must be signed in to change notification settings - Fork 26.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Flutter Firestore take long retrieving data while offline #31393
Comments
I am having the same problem. |
Unfortunately not, waiting to be checked from Firebase Flutter developers |
I noticed that if you wait for a few minutes and then try it again, the retrieve time goes back down to milliseconds. |
@edsheedy any news on that. Please vote the original question up that this get attention. |
Same issue here |
This is a critical performance issue for us. Offline access should be lightning fast and one of the major reasons for selecting Firestore over other solutions. |
I found a workaround for this issue, before calling If there is no connection we can change the source from Firestore : https://pub.dev/documentation/cloud_firestore/latest/cloud_firestore/Source-class.html
And we can set the source to get the documents or document.
|
And finally, with the help of @diegoveloper comment, I have reached the solution. This comment
was a good solution if I decided to check source each time and then use it or I can use it in starting of a new Flutter project, but now I already have a lot of codes that need a better solution. So I decided to fork the cloud_firestore package and edit it. You can find it here: https://github.com/ShadyBoshra2012/flutterfire/tree/master/packages/cloud_firestore What I have edited:
How you can use it?So you can use my forked repository in this way with using connectivity package from Google : https://pub.dev/packages/connectivity . Add my forked repository in
Then in your first screen or main
and if you want to refresh the source when change the connection state:
So I hope it works with everyone see it, and waiting for Flutter Team to code a better and better solution. Thanks for everyone has participated. |
This issue has been moved to firebase/flutterfire#1231. Any further collaboration will be done there. |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Steps to Reproduce
I am using Firestore in flutter application. Each time user launch the application it retrieves some data from cloud.
When user opens the application on first time, it required from him to connect online, to get the data, and as Firebase documents say
So, it should save the data that application have been read before to retrieve it while the device is offline; so user can access application at anytime with the same data that have been read.
The problem is: it takes long time to retrieve the data while the device is offline, with the same codes and nothing changed!.
Logs
The text was updated successfully, but these errors were encountered: