class Announcement { final String id; final String title; final String content; final DateTime createdAt; final String? targetRole; Announcement({ required this.id, required this.title, required this.content, required this.createdAt, this.targetRole, }); factory Announcement.fromMap(Map map) { return Announcement( id: map['id'] ?? '', title: map['title'] ?? '', content: map['content'] ?? '', createdAt: DateTime.tryParse(map['created_at'] ?? '') ?? DateTime.now(), targetRole: map['target_role'], ); } Map toMap() { return { 'title': title, 'content': content, 'target_role': targetRole, }; } }