class Events { String? id; String? name; String? place; String? startDate; String? endDate; String? description; double? latitude; double? longitude; List? tags; List? 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}); Events.fromJson(Map json) { 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?) ?.cast(); // Convert List to List organizers = (json['organizers'] as List?) ?.cast(); // Convert List to List imgUrl = json['imgUrl'] as String?; } }