I am using Firestore in flutter application. Each time user launch the application it retrieves some data from cloud.
QuerySnapshot dataSnapshot = await Firestore.instance
.collection('/data')
.getDocuments();
When user opens the application on first time, it required from him to connect online, to get the data, and as Firebase documents say
For Android and iOS, offline persistence is enabled by default. To disable persistence, set the PersistenceEnabled option to false.
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!.
I tried to configure how much time it takes? On offline, it takes about 8 minutes and 40 seconds. But while on online, it takes just 10 seconds, maybe less.
------------------------------------------------------------
Gradle 4.10.2
------------------------------------------------------------
Build time: 2018-09-19 18:10:15 UTC
Revision: b4d8d5d170bb4ba516e88d7fe5647e2323d791dd
Kotlin DSL: 1.0-rc-6
Kotlin: 1.2.61
Groovy: 2.4.15
Ant: Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM: 1.8.0_152-release (JetBrains s.r.o 25.152-b01)
OS: Windows 10 10.0 amd64
[√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [Version 10.0.17134.648], locale en-US)
• Flutter version 1.2.1 at E:\flutter
• Framework revision 8661d8aecd (9 weeks ago), 2019-02-14 19:19:53 -0800
• Engine revision 3757390fa4
• Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at C:\Users\shady\AppData\Local\Android\sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = C:\Users\shady\AppData\Local\Android\sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
• All Android licenses accepted.
[√] Android Studio (version 3.4)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin version 34.0.2
• Dart plugin version 183.5901
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1343-b01)
[√] VS Code (version 1.32.3)
• VS Code at C:\Users\shady\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 2.24.0
[√] Connected device (1 available)
• Android SDK built for x86 • emulator-5554 • android-x86 • Android 8.1.0 (API 27) (emulator)
• No issues found!
@ShadyBoshra2012
The issue at https://github.com/flutter/flutter/issues/31393 has been closed and moved here. Future collaboration on this issue will be done here.
Ok then. Can you post my temp solution until firebase developer solve it?
@ShadyBoshra2012 has a proposed work around at https://github.com/flutter/flutter/issues/31393#issuecomment-534752883
I think the first step from the flutter guys would be to post an example that has a offline and online handling in there which actually works. I had a really hard time to find anything. If that is a proposed feature should u not have test cases in flutter which illustrate this important feature. The transaction did not work and then I had these long delays in the offline case (still not sure of the right handling). I hacked it based on some of the feedback I did see and basically have no time post an example project which should come from the creator of the feature in the first place. Sorry for the rant but this did cost me to much time to deal with.
Again - please share an 'simple' example project which contains the offline handling and the proposed handling and I will pitch in.
Any news on this issue?
This is an issue for me too.
Most helpful comment
Any news on this issue?