anyway/frontend/lib/structs/landmark.dart
Remy Moll 040e5c9f83
Some checks failed
Build and push docker image / Build (pull_request) Failing after 2m10s
Build and release APK / Build APK (pull_request) Successful in 6m34s
Build web / Build Web (pull_request) Successful in 1m42s
cleaner ci
2024-06-07 10:44:37 +02:00

70 lines
1.6 KiB
Dart

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<String, dynamic> 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<String, dynamic> 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,
});
}