So if the response is {['myHeader': 'myData']}.
how can I get the 'myHeader'.
FutureBuilder(
future: api_response,
builder: (context, snapshot){
return Text(snapshot.data[0]['myHeader']);
},
)
This is the code that I've been using to get the 'myData'.
Thanks in advance
Please try testing below code. You need to return Widget when snapshot has a data.
FutureBuilder(
future: api_response,
builder: (context, snapshot){
if (snapshot.hasData) {
return Text(snapshot.data[0]['myHeader']);
}
},
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.