25 lines
682 B
Dart
25 lines
682 B
Dart
// Represents a collection of landmarks that represent a journey
|
|
// Different instances of a Trip can be saved and loaded by the user
|
|
|
|
import 'package:fast_network_navigation/structs/landmark.dart';
|
|
|
|
class Trip {
|
|
final String uuid;
|
|
final String cityName;
|
|
final List<Landmark> landmarks;
|
|
|
|
|
|
Trip({required this.uuid, required this.cityName, required this.landmarks});
|
|
|
|
factory Trip.fromJson(Map<String, dynamic> json) {
|
|
List<Landmark> landmarks = [];
|
|
for (var landmark in json['landmarks']) {
|
|
landmarks.add(Landmark.fromJson(landmark));
|
|
}
|
|
return Trip(
|
|
uuid: json['uuid'],
|
|
cityName: json['cityName'],
|
|
landmarks: landmarks,
|
|
);
|
|
}
|
|
} |