You are getting the error because data has not available at the time your build method runs. so, you need to check if data is available then show your Gridview.
See the following code in the builder method you need to check snapshot has data or not also check the connection status ones connection status is done you can show Gridview
builder:(BuildContext context, AsyncSnapshot<dynamic> snapshot) {
if (!snapshot.hasData) {
return Loader();
}
if (snapshot.connectionState == ConnectionState.done) {
// Your Gridview should be here
}
return Loader();
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…