35 lines
788 B
Dart
35 lines
788 B
Dart
class ToDo {
|
|
String title;
|
|
String? description;
|
|
DateTime deadline;
|
|
String priority; // High, Medium, Low
|
|
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'],
|
|
);
|
|
}
|
|
} |