flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

🐛 [cloud_firestore] FR: Source option for snapshots()

Open michalkubizna opened this issue 1 year ago • 1 comments

It's possible to pass "source" to GetOptions in the get() calls to make it retrieve the cache-only updates.

Implement the same feature for the real-time listener.

Use case: I’d like to create a comment section. A real-time listener doesn’t work with pagination in a dynamic collection like that since the moment comments are deleted or added the start value changes for each listener resulting in an inconsistent state.

A solution is to implement pagination using one-time get calls but that forces me to implement my own caching or state management solution to update the local data on the user’s device when they make changes (e.g add, delete, or like a comment). It’s a shame because Firestore implements its own caching solution and listening to the local cache would update fetched data with the user’s updates automatically.

michalkubizna avatar Dec 07 '22 12:12 michalkubizna