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.

65 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<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 = <SuppliesUsing>[];
  38. json['suppliesUsing'].forEach((v) {
  39. suppliesUsing?.add(SuppliesUsing.fromJson(v));
  40. });
  41. }
  42. }
  43. Map<String, dynamic> toJson() {
  44. final data = <String, dynamic>{};
  45. data['id'] = id;
  46. data['activityId'] = activityId;
  47. data['cropId'] = cropId;
  48. data['executeDate'] = executeDate;
  49. data['description'] = description;
  50. data['executeBy'] = executeBy;
  51. data['density'] = density;
  52. data['quantity'] = quantity;
  53. data['media'] = media;
  54. data['media_del'] = mediaDel;
  55. if (suppliesUsing != null) {
  56. data['suppliesUsing'] = suppliesUsing?.map((v) => v.toJson()).toList();
  57. }
  58. return data;
  59. }
  60. }