Add FirestoreBuilder widget as a replacement to StreamBuilder #6034
Unanswered
rrousselGit
asked this question in
Feature request
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
As the moment, FIrestore is typically used like do:
The problem with this approach is, whenever the widget that created the
StreamBuilder
is rebuilt, a newStream
is created. Similarly, if we have twoStreamBuilder
rebuilding to the same reference, that will still create two streams and two connections with the native. Both of which are not ideal for performanceWe could solve this problem by introducing a
FirestoreBuilder
, which would work likeStreamBuilder
, but instead of taking aStream
as parameter, it would take a document/collection/query reference:Since references are immutable, this would enable
FirestoreBuilder
to not recreate the snapshot stream when the widget rebuilds, while also potentially caching the stream across allFirestoreBuilder
instances (if desired at all).Some open-ended questions:
.snapshots().where
or.map
?This is potentially not a problem since queries support filter operations and the recently added
withConverter
should solve map use-cases.Beta Was this translation helpful? Give feedback.
All reactions