Я полагаю, вы получаете snapshot
от FutureBuilder
, попробуйте это,
FutureBuilder(
future: ...,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting)
return Center(child: CircularProgressIndicator());
else if (snapshot.hasError)
return Center(child: Text("ERROR: ${snapshot.error}"));
else {
final children = <Widget>[];
snapshot.data.documents.forEach((doc) {
if (document['id'] == nomines[0] ||
document['id'] == nomines[1])
children.add(
Container(
child: InkWell(
onTap: () {
vote(document['id']).then((a) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
Waitresults(),
),
);
});
},
child: OvalPic(document['photo'], document['couleur']),
),
),
);
});
return new GridView.count(
crossAxisCount: 2,
children: children,
);
}
},
);