class Landmark { final String name; final List location; final LandmarkType type; final String imageURL; // final String description; // final Duration duration; // final bool visited; const Landmark({ required this.name, required this.location, required this.type, this.imageURL = 'https://upload.wikimedia.org/wikipedia/commons/thumb/a/a8/Tour_Eiffel_Wikimedia_Commons.jpg/1037px-Tour_Eiffel_Wikimedia_Commons.jpg', // required this.description, // required this.duration, // required this.visited, }); factory Landmark.fromJson(Map json) { return switch (json) { { 'loc': List location, 'name': String name, 'type': String type, // 'description': String description, // 'duration': int duration, // 'visited': bool visited } => Landmark( name: name, location: location, type: LandmarkType(name: type) // description: description, // duration: Duration(minutes: duration), // visited: visited ), _ => throw const FormatException('Failed to load destination.'), }; } Map toJson() { return { 'name': name, 'location': location, 'type': type.name, // 'description': description, // 'duration': duration.inMinutes, // 'visited': visited }; } } class LandmarkType { final String name; // final String description; // final Icon icon; const LandmarkType({ required this.name, // required this.description, // required this.icon, }); }