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.

66 lines
1.7KB

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