Converts the task to a JSON-compatible map for persistence.
Map<String, dynamic> toJson() { return { 'id': id, 'title': title, 'subtitle': subtitle, }; }