我收到此错误:
无法加载源'dart:core / runtime / libobject_patch.dart':<源不可用\>
我有两个下拉列表(一个带有体育项目的下拉列表,另一个带有国家的列表)和一个联赛列表。在下拉列表中选择项目时,应该对带有联赛的列表进行排序。当我在下拉列表中选择城市时,会弹出此错误。
Future<List<ListTile>> _getListLeagues() async {
http.Response data;
String _str = "countrys";
List<ListTile> listTiles = [];
if ((_choiseCountry == null) & (_choisesport == null)) {
data = await http
.get("https://www.thesportsdb.com/api/v1/json/1/all_leagues.php");
_str = "leagues";
} else if ((_choisesport != null) & (_choiseCountry == null)) {
data = await http.get(
"https://www.thesportsdb.com/api/v1/json/1/search_all_leagues.php?s=$_choisesport");
} else if ((_choiseCountry != null) & (_choisesport == null)) {
data = await http.get(
"https://www.thesportsdb.com/api/v1/json/1/search_all_leagues.php?c=$_choiseCountry");
} else {
data = await http.get(
"https://www.thesportsdb.com/api/v1/json/1/search_all_leagues.php?c=$_choiseCountry&s=$_choisesport");
}
var jsonData = json.decode(data.body);
for (var index in jsonData[_str]) {
if (((_choisesport != null) & (_choisesport == index["strSport"])) |
(_choisesport == null)) {
ListTile list = ListTile(
title: Text(index["strLeague"]),
subtitle: Text(index["strSport"]),
);
listTiles.add(list);
}
}
return listTiles;
}
}
Future<List<DropdownMenuItem<String>>> _sports() async {
var data = await http
.get("https://www.thesportsdb.com/api/v1/json/1/all_sports.php");
var jsonData = json.decode(data.body);
List<DropdownMenuItem<String>> droplist = [];
for (var sport in jsonData["sports"]) {
droplist.add(DropdownMenuItem(
child: Row(children: <Widget>[
Text(sport["strSport"].toString()),
]),
value: sport["strSport"],
));
}
return droplist;
}