【发布时间】:2021-11-11 03:31:48
【问题描述】:
class Product {
String status;
List<List> note;
List<List> table;
Product({this.status, this.note, this.table});
Product.fromJson(Map<String, dynamic> json) {
status = json['status'];
if (json['note'] != null) {
note = <List>[];
json['note'].forEach((v) { note.add(new List.fromJson(v)); });
}
if (json['table'] != null) {
table = <List>[];
json['table'].forEach((v) { table.add(new List.fromJson(v)); });
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['status'] = this.status;
if (this.note != null) {
data['note'] = this.note.map((v) => v.toJson()).toList();
}
if (this.table != null) {
data['table'] = this.table.map((v) => v.toJson()).toList();
}
return data;
}
}
“List”类没有名为“fromJson”的构造函数。 尝试调用不同的构造函数,或定义一个名为“fromJson”的构造函数。 / List.fromJson 和 v.toJson 出错
【问题讨论】:
标签: json flutter flutter-getx flutter-http