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.

47 lines
1.2KB

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