我是 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 { …
Run Code Online (Sandbox Code Playgroud)