You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.7KB

  1. class Plant {
  2. int cropId;
  3. String executeDate;
  4. String description;
  5. String density;
  6. num quantity;
  7. List<SuppliesUsing> suppliesUsing;
  8. Plant(
  9. {this.cropId,
  10. this.executeDate,
  11. this.description,
  12. this.density,
  13. this.quantity,
  14. this.suppliesUsing});
  15. Plant.fromJson(Map<String, dynamic> json) {
  16. cropId = json['cropId'];
  17. executeDate = json['executeDate'];
  18. description = json['description'];
  19. density = json['density'];
  20. quantity = json['quantity'];
  21. if (json['suppliesUsing'] != null) {
  22. suppliesUsing = new List<SuppliesUsing>();
  23. json['suppliesUsing'].forEach((v) {
  24. suppliesUsing.add(new SuppliesUsing.fromJson(v));
  25. });
  26. }
  27. }
  28. Map<String, dynamic> toJson() {
  29. final Map<String, dynamic> data = new Map<String, dynamic>();
  30. data['cropId'] = this.cropId;
  31. data['executeDate'] = this.executeDate;
  32. data['description'] = this.description;
  33. data['density'] = this.density;
  34. data['quantity'] = this.quantity;
  35. if (this.suppliesUsing != null) {
  36. data['suppliesUsing'] =
  37. this.suppliesUsing.map((v) => v.toJson()).toList();
  38. }
  39. return data;
  40. }
  41. }
  42. class SuppliesUsing {
  43. String dosage;
  44. int quantity;
  45. int suppliesInWarehouseId;
  46. SuppliesUsing({this.dosage, this.quantity, this.suppliesInWarehouseId});
  47. SuppliesUsing.fromJson(Map<String, dynamic> json) {
  48. dosage = json['dosage'];
  49. quantity = json['quantity'];
  50. suppliesInWarehouseId = json['suppliesInWarehouseId'];
  51. }
  52. Map<String, dynamic> toJson() {
  53. final Map<String, dynamic> data = new Map<String, dynamic>();
  54. data['dosage'] = this.dosage;
  55. data['quantity'] = this.quantity;
  56. data['suppliesInWarehouseId'] = this.suppliesInWarehouseId;
  57. return data;
  58. }
  59. }