2024-10-22 20:42:08 +02:00
|
|
|
class ToDo {
|
|
|
|
String title;
|
|
|
|
String? description;
|
|
|
|
DateTime deadline;
|
2024-10-29 17:37:12 +01:00
|
|
|
String priority;
|
2024-10-22 20:42:08 +02:00
|
|
|
bool isCompleted;
|
|
|
|
|
|
|
|
ToDo({
|
|
|
|
required this.title,
|
|
|
|
required this.description,
|
|
|
|
required this.deadline,
|
|
|
|
required this.priority,
|
|
|
|
this.isCompleted = false,
|
|
|
|
});
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() {
|
|
|
|
return {
|
|
|
|
'title': title,
|
|
|
|
'description': description,
|
|
|
|
'deadline': deadline.toIso8601String(),
|
|
|
|
'priority': priority,
|
|
|
|
'isCompleted': isCompleted,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
static ToDo fromJson(Map<String, dynamic> json) {
|
|
|
|
return ToDo(
|
|
|
|
title: json['title'],
|
|
|
|
description: json['description'],
|
|
|
|
deadline: DateTime.parse(json['deadline']),
|
|
|
|
priority: json['priority'],
|
|
|
|
isCompleted: json['isCompleted'],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|