import 'SuppliesUsing.dart'; class Plant { int cropId; String executeDate; String description; String density; num quantity; List suppliesUsing; Plant( {this.cropId, this.executeDate, this.description, this.density, this.quantity, this.suppliesUsing}); Plant.fromJson(Map json) { cropId = json['cropId']; executeDate = json['executeDate']; description = json['description']; density = json['density']; quantity = json['quantity']; if (json['suppliesUsing'] != null) { suppliesUsing = new List(); json['suppliesUsing'].forEach((v) { suppliesUsing.add(new SuppliesUsing.fromJson(v)); }); } } Map toJson() { final Map data = new Map(); data['cropId'] = this.cropId; data['executeDate'] = this.executeDate; data['description'] = this.description; data['density'] = this.density; data['quantity'] = this.quantity; if (this.suppliesUsing != null) { data['suppliesUsing'] = this.suppliesUsing.map((v) => v.toJson()).toList(); } return data; } }