43 lines
1.2 KiB
Dart
Raw Permalink Normal View History

2024-06-24 23:57:43 +02:00
class Events {
String? id;
String? name;
String? place;
2024-06-27 00:01:07 +02:00
String? startDate;
2024-09-25 23:08:28 +02:00
String? endDate;
String? description;
2024-11-15 23:22:17 +01:00
double? latitude;
double? longitude;
2024-12-13 23:49:56 +01:00
List<String>? tags;
List<String>? organizers;
String? imgUrl;
Events(
{this.place,
this.id,
this.name,
this.startDate,
this.description,
this.endDate,
this.tags,
this.latitude,
this.longitude,
this.organizers,
this.imgUrl});
2024-06-24 23:57:43 +02:00
Events.fromJson(Map<String, dynamic> json) {
2024-12-13 23:49:56 +01:00
id = json['id'] as String?;
name = json['name'] as String?;
place = json['place'] as String?;
startDate = json['start_date'] as String?;
endDate = json['end_date'] as String?;
description = json['description'] as String?;
latitude = (json['latitude'] as num?)?.toDouble(); // Safely cast to double
longitude =
(json['longitude'] as num?)?.toDouble(); // Safely cast to double
tags = (json['tags'] as List<dynamic>?)
?.cast<String>(); // Convert List<dynamic> to List<String>
organizers = (json['organizers'] as List<dynamic>?)
?.cast<String>(); // Convert List<dynamic> to List<String>
imgUrl = json['imgUrl'] as String?;
2024-06-24 23:57:43 +02:00
}
}