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.

59 lines
1.6KB

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