First, you shouldn’t return null
from FutureBuilder
. And to access the data you should use snapshot.data
. Something like this:
FutureBuilder<List>(
future: clusters,
builder: (BuildContext context, AsyncSnapshot<List> snapshot) {
if (snapshot.hasData) {
print("clusters: ${snapshot.data.join(", ")}");
return Text("Hello");
}
return SizedBox();
},
)
CLICK HERE to find out more related problems solutions.