【发布时间】:2020-07-28 12:05:59
【问题描述】:
当我尝试从这个 API https://api.met.no/weatherapi/locationforecast/2.0/complete?lat=10&lon=10 获取数据时,它会得到一个包含所有时间序列的长数组。最后,我想显示每次下载的数组中都有自己位置的一些数据。我想将所有数据转换为一个列表,以便我可以操作数据,但是我得到了像这些类型'_InternalLinkedHashMap
List<dynamic> timeseriesglobal = [];
void loadForecast() async{
//Getting the data from API
Response response = await get("https://api.met.no/weatherapi/locationforecast/2.0/complete?lat=57.047218&lon=9.920100");
var results = jsonDecode(response.body);
timeseriesglobal = results["properties"]["timeseries"] as List;
}
最后我得到了显示数据的代码
child: ListView.builder(
itemCount: timeseriesglobal.length,
itemBuilder: (context,index){
return Card(
child: ListTile(
title: Text(
timeseriesglobal[index]
),
),
);
},
我做错了什么?请帮帮我
【问题讨论】: