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
StreamBuilderis rebuilt, a newStreamis created. Similarly, if we have twoStreamBuilderrebuilding 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 aStreamas parameter, it would take a document/collection/query reference:Since references are immutable, this would enable
FirestoreBuilderto not recreate the snapshot stream when the widget rebuilds, while also potentially caching the stream across allFirestoreBuilderinstances (if desired at all).Some open-ended questions:
.snapshots().whereor.map?This is potentially not a problem since queries support filter operations and the recently added
withConvertershould solve map use-cases.Beta Was this translation helpful? Give feedback.
All reactions