作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我收到这个错误:
Could not load source 'dart:core/runtime/libobject_patch.dart': <source not available\>
我有两个下拉列表(一个关于体育项目的下拉列表,另一个关于国家/地区的列表)和一个关于联赛的列表。在下拉列表中选择项目时应该对带有联赛的列表进行排序,当我在下拉列表中选择城市时会弹出此错误。
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;
}
最佳答案
NoSuchMethodError 问题通常发生在调用方法的类尚未初始化或方法本身不存在的情况下。在这种情况下,正如之前评论中提到的那样,问题似乎与此类似 ticket发布在 GitHub 上。检查线程,问题应该已经解决。我建议更新您的应用中使用的 Dart 和 Flutter SDK 以解决此问题。
关于dart - 无法加载源 'dart:core/runtime/libobject_patch.dart' : <source not available>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54390922/
我收到这个错误: Could not load source 'dart:core/runtime/libobject_patch.dart': Project on GitHub 我有两个下拉列表
我是一名优秀的程序员,十分优秀!