I save pictures in Firebase Storage, I save links to them in Firestore, and so on, from Firestore I want to get links and show those pics. I don't know really know where I made mistake. Maybe changing stream will be helpful? Or maybe snapshots? This is the path I save links:
Firestore.instance
.collection('images')
.document()
.collection('others')
.add({"url": downloadUrl});
Can you please, help me fixing preview of those pictures? I did that with StreamBuilder:
List<String> listOfUrls = List();
List<Widget> listOfPics = List();
@override
Widget build(BuildContext context) {
return StreamBuilder(
stream: Firestore.instance.collection('images').doc.collection('others').snapshots(),
builder: (context, snapshot) {
if (!snapshot.hasData)
return Center(child: CircularProgressIndicator());
for (int i = 0; i < snapshot.data.documents.length; i++) {
listOfUrls.add(snapshot.data.documents[i]['url']);
listOfPics.add(Padding(
padding: const EdgeInsets.only(top: 50, bottom: 50),
child: Image.network(listOfUrls[i]),
));
}
return ListView(
shrinkWrap: true,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(widget.text),
),
ListView(
shrinkWrap: true,
children: listOfPics,
),
],
);
});
}