No clean solution for Firestore + Flutter with offline access

327 views
Skip to first unread message

Jagannathan Srinivasan

unread,
Jun 2, 2019, 12:28:44 PM6/2/19
to Flutter Dev
I'm using Cloud Firestore package but none of the Firestore operations work reliably if phone is offline, despite everything the documentation says. I'm quite frustrated that I have to keep checking for internet connectivity before issuing any Firestore calls. I should be able to make the Firestore calls the same way and I expect the calls to fall back on to local cache if there's no connection, else the calls should transparently go online. Is this too much to expect, given all the documentation? Or am I doing something seriously wrong?

Jagan

Ryan Gonzalez

unread,
Jun 2, 2019, 2:04:15 PM6/2/19
to Flutter Dev, Jagannathan Srinivasan
Make sure offline persistence is enabled. If it is, this is probably a bug.
On Jun 2, 2019, 11:28 AM -0500, Jagannathan Srinivasan <jagan.sr...@gmail.com>, wrote:
I'm using Cloud Firestore package but none of the Firestore operations work reliably if phone is offline, despite everything the documentation says. I'm quite frustrated that I have to keep checking for internet connectivity before issuing any Firestore calls. I should be able to make the Firestore calls the same way and I expect the calls to fall back on to local cache if there's no connection, else the calls should transparently go online. Is this too much to expect, given all the documentation? Or am I doing something seriously wrong?

Jagan

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/CADHgxFzu7od2SkV7YzquoM1qhVUsZxQgm%3D5Mj6UQnMieSG0iuA%40mail.gmail.com.

Jagannathan Srinivasan

unread,
Jun 3, 2019, 3:48:47 AM6/3/19
to Ryan Gonzalez, Flutter Dev
I explicitly enabled offline persistence (though documentation says this is enabled by default on Android) The same behavior persists. Looks like Android/Java has mechanisms to handle it since we can trap Snapshot events that returns success/failure depending on whether the device is online. But there's no such thing in Flutter / Cloud Firestore, hence I'm getting this unpredictable/inconsistent behavior.

--Jagan

Jeremy Whiteley

unread,
Jun 3, 2019, 3:48:54 PM6/3/19
to Flutter Development (flutter-dev)
Does this happen on both Android and IOS? Are you using the latest version of the plugins? I think you might have to migrate to AndroidX too.   
Reply all
Reply to author
Forward
0 new messages