KonectarApp/lib/model/eventsmodel.dart

99 lines
2.4 KiB
Dart

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<String, dynamic> json) =>
EventListResponse(
data: EventData.fromJson(json["data"]),
);
Map<String, dynamic> toJson() => {
"data": data.toJson(),
};
}
class EventData {
List<EventsListOld> events;
EventData({
required this.events,
});
factory EventData.fromJson(Map<String, dynamic> json) => EventData(
events: List<EventsListOld>.from(
json["events"].map((x) => EventsListOld.fromJson(x))),
);
Map<String, dynamic> toJson() => {
"events": List<dynamic>.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<String, dynamic> 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<String, dynamic> 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,
};
}