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 toJson() { return { 'id' : id, 'name': name, 'description': description, 'dueDate': dueDate.toIso8601String(), 'status': status, }; } static ToDoItem fromJson(Map json) { return ToDoItem( id: json['id'], name: json['name'], description: json['description'], dueDate: DateTime.parse(json['dueDate']), status: json['status'], ); } }