I have a simple code with a ListView.builder connected to Cloud Firestore. Each List item looks like this:
As you can see, there's a leading image. Until now, it is storage in a assets/images/
folder. I want to add the images to Firebase Storage, so that each list item have a specific and unique image. The solutions I've seen to retrieve images uses FutureBuilder
and stream
, but I already use a StreamBuilder
and stream
for the Cloud Firestore.
I just want some light on what I can/need to do, there's no need of code. Can't think of a way to do it.
CodePudding user response:
It is possible (and in fact, quite common) to nest StreamBuilder
s and FutureBuilder
s.
For example, if you have documents in Firestore, and each of those contains the URL of an image in Cloud Storage, you'll typically end up with:
- a
StreamBuilder
for the Firestore documents, so that you can keep the UI in sync with the database. - a separate
FutureBuilder
for each image.
Since these are separate load operations, you need a separate *Builder
for each of them. That is not a problem, and in fact working-as-intended.