cpd_2024_todo/lib/buisness/ToDoItem.dart

35 lines
698 B
Dart

class ToDoItem {
int? id;
String name;
String description;
DateTime dueDate;
String status;
ToDoItem({
this.id,
required this.name,
required this.description,
required this.dueDate,
this.status = 'Pending',
});
Map<String, dynamic> toMap() {
return {
'id' : id,
'name': name,
'description': description,
'dueDate': dueDate.toIso8601String(),
'status': status,
};
}
static ToDoItem fromMap(Map<String, dynamic> json) {
return ToDoItem(
id: json['id'],
name: json['name'],
description: json['description'],
dueDate: DateTime.parse(json['dueDate']),
status: json['status'],
);
}
}