2021年3月28日星期日

how to use this type of json in Futur Builder snapshot

i have this json file and want to use prices of AUDUSD in my Futur builder

json:

{"price":{"AUDUSD":0.76411,"EURUSD":1.17937,"GBPUSD":1.37923,"USDJPY":109.676},"timestamp":1616951788}  

my Future Builder

 **FutureBuilder(            future: getData(),            builder: (buildcontext, AsyncSnapshot snapshot) {              if (snapshot.hasData) {                return ListView.builder(                  itemBuilder: (context, i) {                    return Container(                      child: Text(snapshot.data[i][////what should i put here]),**  

my http request:

  **Future getData() async {  var url = 'http://------.com/curen.php';  var response = await http.get(url);  var responsebody = jsonDecode(response.body);  return (responsebody);  

}**

https://stackoverflow.com/questions/66847218/how-to-use-this-type-of-json-in-futur-builder-snapshot March 29, 2021 at 07:45AM

没有评论:

发表评论