import 'dart:convert'; EventListResponse welcomeFromJson(String str) => EventListResponse.fromJson(json.decode(str)); String welcomeToJson(EventListResponse data) => json.encode(data.toJson()); class EventListResponse { EventData data; EventListResponse({ required this.data, }); factory EventListResponse.fromJson(Map json) => EventListResponse( data: EventData.fromJson(json["data"]), ); Map toJson() => { "data": data.toJson(), }; } class EventData { List events; EventData({ required this.events, }); factory EventData.fromJson(Map json) => EventData( events: List.from( json["events"].map((x) => EventsListOld.fromJson(x))), ); Map toJson() => { "events": List.from(events.map((x) => x.toJson())), }; } class EventsListOld { String eventId; String eventName; String organizer; String startdate; String enddate; String city; String state; String country; String websitelink; String attendees; String clientAttendees; bool? isfav; EventsListOld({ required this.eventId, required this.eventName, required this.organizer, required this.startdate, required this.enddate, required this.city, required this.state, required this.country, required this.websitelink, required this.attendees, required this.clientAttendees, this.isfav = false, }); factory EventsListOld.fromJson(Map json) => EventsListOld( eventId: json["event_id"], eventName: json["event_name"], organizer: json["organizer"], startdate: json["startdate"], enddate: json["enddate"], city: json["city"], state: json["state"], country: json["country"], websitelink: json["websitelink"], attendees: json["attendees"], clientAttendees: json["client_attendees"], ); Map toJson() => { "event_id": eventId, "event_name": eventName, "organizer": organizer, "startdate": startdate, "enddate": enddate, "city": city, "state": state, "country": country, "websitelink": websitelink, "attendees": attendees, "client_attendees": clientAttendees, }; }