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.

73 lines
1.7KB

  1. class Task {
  2. int? id;
  3. String? title;
  4. String? description;
  5. String? dueDate;
  6. String? executeDate;
  7. Assigned? assigned;
  8. bool? isCompleted;
  9. Task({
  10. this.id,
  11. this.title,
  12. this.description,
  13. this.dueDate,
  14. this.executeDate,
  15. this.assigned,
  16. this.isCompleted,
  17. });
  18. Task.fromJson(Map<String, dynamic> json) {
  19. title = json['title'];
  20. id = json['id'];
  21. description = json['detail'];
  22. dueDate = json['deadline'];
  23. executeDate = json['executeDate'];
  24. assigned = json['assigned'] != null ? new Assigned.fromJson(json['assigned']) : null;
  25. isCompleted = json['completed'];
  26. }
  27. Map<String, dynamic> toJson() {
  28. final Map<String, dynamic> data = new Map<String, dynamic>();
  29. data['id'] = this.id;
  30. data['title'] = this.title;
  31. data['detail'] = this.description;
  32. data['deadline'] = this.dueDate;
  33. data['executeDate'] = this.executeDate;
  34. if (this.assigned != null) {
  35. data['assigned'] = this.assigned?.toJson();
  36. }
  37. data['completed'] = this.isCompleted;
  38. return data;
  39. }
  40. Task.clone(Task task) {
  41. this.id = task.id;
  42. this.title = task.title;
  43. this.description = task.description;
  44. this.dueDate = task.dueDate;
  45. this.executeDate = task.executeDate;
  46. this.assigned = task.assigned;
  47. this.isCompleted = task.isCompleted;
  48. }
  49. }
  50. class Assigned {
  51. int? id;
  52. bool? activated;
  53. Assigned({this.id, this.activated});
  54. Assigned.fromJson(Map<String, dynamic> json) {
  55. id = json['id'];
  56. activated = json['activated'];
  57. }
  58. Map<String, dynamic> toJson() {
  59. final Map<String, dynamic> data = new Map<String, dynamic>();
  60. data['id'] = this.id;
  61. data['activated'] = this.activated;
  62. return data;
  63. }
  64. }