anyway/frontend/lib/structs/landmark.dart
Remy Moll d5e0b7d51a
Some checks failed
Build and push docker image / Build (pull_request) Failing after 2m49s
Build and release APK / Build APK (pull_request) Successful in 5m48s
Build web / Build Web (pull_request) Successful in 1m32s
Beginning to use different contexts
2024-06-03 13:51:01 +02:00

68 lines
1.5 KiB
Dart

class Landmark {
final String name;
final List location;
final LandmarkType type;
// final String description;
// final Duration duration;
// final bool visited;
const Landmark({
required this.name,
required this.location,
required this.type,
// 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,
});
}