Flutter List 不是“Iterable<dynamic>”类型的子类型

And*_*oid 5 json dart flutter

我是 Flutter 开发的新手。我收到错误

列表不是“Iterable”类型的子类型

到目前为止我已经做到了这一点。

模型类

class Categories {
final String title;
final Items items;

Categories({this.title, this.items});

 factory Categories.fromJson(Map<String, dynamic> json) {
  return new Categories(
    title: json['title'],
    items: Items.fromJson(json['Items']));
  }
}

class Items {
final String tag;
final String childId;
final String category;
final String isNew;

Items({this.tag, this.childId, this.category, this.isNew});

factory Items.fromJson(Map<String, dynamic> json) {
return new Items(
    tag: json['id'],
    childId: json['child_category_id'],
    category: json['category'],
    isNew: json['new']);
 }}
Run Code Online (Sandbox Code Playgroud)

缅因州内舱

List<Categories> categories = [];
var loading = false;

 Future<Null> getNavigationItems() async {
setState(() {
  loading = true;
});

final response = await http.get(Uri.encodeFull(APIs.url_getCategory2));
if (response.statusCode == 200) {
  final data = jsonDecode(utf8.decode(response.bodyBytes));

  setState(() {
    for(Map i in data){
      categories.add(Categories.fromJson(i));
    }


    loading = false;
  });
}
Run Code Online (Sandbox Code Playgroud)

}

我正在尝试解决 2 天的问题。

这是我从服务器端获取的 JSON 格式JSON结构

这是在扩展其第一个节点之后JSON扩展

更新图片这是

错误

请帮助并谢谢。

这是 JSON 响应,您可以查看链接

屏幕1 屏幕2

A R*_*A R 0

您尝试使用var代替吗Map

for (var i in data) {
          categories.add(Categories.fromJson(i));
        }
Run Code Online (Sandbox Code Playgroud)