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.

63 lines
1.6KB

  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<SuppliesUsing> suppliesUsing;
  13. Plant(
  14. {this.id,
  15. this.activityId,
  16. this.cropId,
  17. this.executeDate,
  18. this.description,
  19. this.executeBy,
  20. this.density,
  21. this.quantity,
  22. this.media,
  23. this.suppliesUsing});
  24. Plant.fromJson(Map<String, dynamic> json) {
  25. id = json['id'];
  26. activityId = json['activityId'];
  27. cropId = json['cropId'];
  28. executeDate = json['executeDate'];
  29. description = json['description'];
  30. executeBy = json['executeBy'];
  31. density = json['density'];
  32. quantity = json['quantity'];
  33. media = json['media'];
  34. if (json['suppliesUsing'] != null) {
  35. suppliesUsing = new List<SuppliesUsing>();
  36. json['suppliesUsing'].forEach((v) {
  37. suppliesUsing.add(new SuppliesUsing.fromJson(v));
  38. });
  39. }
  40. }
  41. Map<String, dynamic> toJson() {
  42. final Map<String, dynamic> data = new Map<String, dynamic>();
  43. data['id'] = this.id;
  44. data['activityId'] = this.activityId;
  45. data['cropId'] = this.cropId;
  46. data['executeDate'] = this.executeDate;
  47. data['description'] = this.description;
  48. data['executeBy'] = this.executeBy;
  49. data['density'] = this.density;
  50. data['quantity'] = this.quantity;
  51. data['media'] = this.media;
  52. if (this.suppliesUsing != null) {
  53. data['suppliesUsing'] =
  54. this.suppliesUsing.map((v) => v.toJson()).toList();
  55. }
  56. return data;
  57. }
  58. }