bare implementation of comuncation with the api
This commit is contained in:
@@ -11,6 +11,7 @@ class Trip {
|
||||
final String uuid;
|
||||
final String cityName;
|
||||
// TODO: cityName should be inferred from coordinates of the Landmarks
|
||||
final int totalTime;
|
||||
final LinkedList<Landmark> landmarks;
|
||||
// could be empty as well
|
||||
|
||||
@@ -19,15 +20,18 @@ class Trip {
|
||||
required this.uuid,
|
||||
required this.cityName,
|
||||
required this.landmarks,
|
||||
this.totalTime = 0
|
||||
});
|
||||
|
||||
|
||||
factory Trip.fromJson(Map<String, dynamic> json) {
|
||||
return Trip(
|
||||
Trip trip = Trip(
|
||||
uuid: json['uuid'],
|
||||
cityName: json['city_name'],
|
||||
cityName: json['city_name'] ?? 'Not communicated',
|
||||
landmarks: LinkedList()
|
||||
);
|
||||
|
||||
return trip;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +48,7 @@ class Trip {
|
||||
Map<String, dynamic> toJson() => {
|
||||
'uuid': uuid,
|
||||
'city_name': cityName,
|
||||
'entry_uuid': landmarks.first?.uuid ?? ''
|
||||
'first_landmark_uuid': landmarks.first.uuid
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user