Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Json 颤振-无实例getter';长度';错误_Json_Flutter_Dart - Fatal编程技术网

Json 颤振-无实例getter';长度';错误

Json 颤振-无实例getter';长度';错误,json,flutter,dart,Json,Flutter,Dart,我试图用从公共API获得的Json数据填充我的listview,但是当我试图运行代码时,我得到了以下错误。我尝试使用不同的json数据集访问另一个url,但仍然收到相同的错误 类“List”没有实例获取程序“lenght”。接收人: “\u GrowtableList”的实例(长度:248)尝试调用:lenght 这是我的密码 classcountrycase{ 弦国; 管段塞; 字符串iso; CountryCase(this.country,this.slug,this.iso); json

我试图用从公共API获得的Json数据填充我的listview,但是当我试图运行代码时,我得到了以下错误。我尝试使用不同的json数据集访问另一个url,但仍然收到相同的错误

类“List”没有实例获取程序“lenght”。接收人: “\u GrowtableList”的实例(长度:248)尝试调用:lenght

这是我的密码

classcountrycase{
弦国;
管段塞;
字符串iso;
CountryCase(this.country,this.slug,this.iso);
json(映射json){
country=json['country'];
slug=json['slug'];
iso=json['ISO2'];
}
}
类CountryScreen扩展了StatefulWidget{
CountryScreen({Key}):超级(Key:Key);
@凌驾
_CountryScreenState createState()=>\u CountryScreenState();
}
类\u CountryScreenState扩展状态{
Future fetchInfo()异步{
var apiUrl=https://api.covid19api.com/countries';
var result=await http.get(apirl);
var users=List();
如果(result.statusCode==200){
var usersJson=json.decode(result.body);
for(usersJson中的var用户){
add(CountryCase.json(user));
}
}
返回用户;
}
@凌驾
小部件构建(构建上下文){
返回脚手架(
bottomNavigationBar:BottomNavBar(),
主体:容器(
孩子:未来建设者(
future:fetchInfo(),
生成器:(BuildContext上下文,异步快照){
如果(snapshot.data==null){
返回容器(
儿童:中心(
子项:文本('正在加载数据…'),
),
);
}否则{
返回ListView.builder(
itemCount:snapshot.data==null?0:snapshot.data.Length,
itemBuilder:(构建上下文,int索引){
返回列表块(
标题:文本(快照.数据[索引].控件),
);
},
);
}
},
)),
);
}
}

长度
,而不是
长度
,你打错了


尝试在这样的情况下使用autocomplete,因为它会为您的代码提供可用选项。

它是
长度
,而不是
长度
,您输入了错误

尝试在这样的情况下使用autocomplete,因为它会为您的代码提供可用选项