如果我Future<list>
尝试使用 for 循环或尝试将其设置为List
.
是否有任何其他方法可以遍历列表中的每个元素:
Future<List> getDailyTask(DateTime date) async {
var params = {'date': date.toIso8601String()};
Uri uri = Uri.parse('URL');
final newURI = uri.replace(queryParameters: params);
http.Response response = await http.get(
newURI,
headers: {"Accept": "application/json"},
);
List foo = json.decode(response.body);
return foo;
}