class ProductModel { int? id; String? createdAt; String? updatedAt; String? name; String? remark; int? isDelete; int? companyId; int? unitId; String? namePinyin; List? files; Company? company; Unit? unit; ProductModel( {this.id, this.createdAt, this.updatedAt, this.name, this.remark, this.isDelete, this.companyId, this.unitId, this.namePinyin, this.files, this.company, this.unit}); ProductModel.fromJson(Map json) { id = json['id']; createdAt = json['createdAt']; updatedAt = json['updatedAt']; name = json['name']; remark = json['remark']; isDelete = json['isDelete']; companyId = json['companyId']; unitId = json['unitId']; namePinyin = json['namePinyin']; if (json['files'] != null) { files = []; json['files'].forEach((v) { files!.add(new Files.fromJson(v)); }); } company = json['company'] != null ? new Company.fromJson(json['company']) : null; unit = json['unit'] != null ? new Unit.fromJson(json['unit']) : null; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['createdAt'] = this.createdAt; data['updatedAt'] = this.updatedAt; data['name'] = this.name; data['remark'] = this.remark; data['isDelete'] = this.isDelete; data['companyId'] = this.companyId; data['unitId'] = this.unitId; data['namePinyin'] = this.namePinyin; if (this.files != null) { data['files'] = this.files!.map((v) => v.toJson()).toList(); } if (this.company != null) { data['company'] = this.company!.toJson(); } if (this.unit != null) { data['unit'] = this.unit!.toJson(); } return data; } } class Files { int? id; String? path; Files({this.id, this.path}); Files.fromJson(Map json) { id = json['id']; path = json['path']; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['path'] = this.path; return data; } } class Company { int? id; String? name; Company({this.id, this.name}); Company.fromJson(Map json) { id = json['id']; name = json['name']; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['name'] = this.name; return data; } } class Unit { int? id; String? label; Unit({this.id, this.label}); Unit.fromJson(Map json) { id = json['id']; label = json['label']; } Map toJson() { final Map data = new Map(); data['id'] = this.id; data['label'] = this.label; return data; } }