Я решаю эту проблему с помощью кода ниже:
Widget buildGridFilesToExport(){
return new StreamBuilder(
stream: Firestore.instance
.collection('users')
.document(dataUserGlobal.userAdminId)
.collection('events')
.document(dataUserGlobal.eventId)
.snapshots(),
builder: (context, snapshot) {
print(snapshot);
if (snapshot.hasError)
return new Text('Error: ${snapshot.error}');
switch (snapshot.connectionState) {
case ConnectionState.waiting: return new Text('Loading...');
default:
List videosList = snapshot.data['thumbnailsUrl'];
return
videosList != null ?
new GridView.count(
crossAxisCount: 2,
childAspectRatio: 1,
children: List.generate(snapshot.data['thumbnailsUrl'].length, (index) {
return Container(
padding: EdgeInsets.all(5.0),
child: Column(
children: <Widget>[
Container(
margin: EdgeInsets.only(bottom: 2.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(5.0)),
image: DecorationImage(
image: NetworkImage(snapshot.data['thumbnailsUrl'][index]),
fit: BoxFit.cover,
),
),
),
],
)
);
}),
)
:
Center(
child: Container(
width: 300,
child: Text(
'Ancora nessun video!\nVai nella cartella amici e accetta i loro video!',
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: 'acumin-pro',
fontSize: 22,
),
),
)
);
}
},
);
}