class Event { final String idEvent; final String agegroup; final String name; final String title; final String opponent; final String place; final String start; final String end; final String? color; final String eventType; Event({ required this.idEvent, required this.agegroup, required this.name, required this.title, required this.opponent, required this.place, required this.start, required this.end, this.color, required this.eventType, }); factory Event.fromJson(Map json) => Event( idEvent: json['id_event']?.toString() ?? '', agegroup: json['agegroup'] as String, name: json['name'] as String? ?? '', title: json['title'] as String, opponent: json['opponent'] as String? ?? '', place: json['place'] as String? ?? '', start: json['start'] as String, end: json['end'] as String, color: json['color'] as String?, eventType: json['event'] as String? ?? '', ); Map toJson() => { 'id_event': idEvent, 'agegroup': agegroup, 'name': name, 'title': title, 'opponent': opponent, 'place': place, 'start': start, 'end': end, 'color': color, 'event': eventType, }; }