show correct landmark types when fetching from api
This commit is contained in:
@@ -3,12 +3,13 @@ import 'dart:convert';
|
||||
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
|
||||
const LandmarkType museum = LandmarkType(name: 'Museum');
|
||||
const LandmarkType monument = LandmarkType(name: 'Monument');
|
||||
const LandmarkType park = LandmarkType(name: 'Park');
|
||||
const LandmarkType restaurant = LandmarkType(name: 'Restaurant');
|
||||
const LandmarkType shop = LandmarkType(name: 'Shop');
|
||||
const LandmarkType sightseeing = LandmarkType(name: 'sightseeing');
|
||||
const LandmarkType nature = LandmarkType(name: 'nature');
|
||||
const LandmarkType shopping = LandmarkType(name: 'shopping');
|
||||
// const LandmarkType museum = LandmarkType(name: 'Museum');
|
||||
// const LandmarkType restaurant = LandmarkType(name: 'Restaurant');
|
||||
const LandmarkType start = LandmarkType(name: 'start');
|
||||
const LandmarkType finish = LandmarkType(name: 'finish');
|
||||
|
||||
|
||||
final class Landmark extends LinkedListEntry<Landmark>{
|
||||
@@ -55,7 +56,7 @@ final class Landmark extends LinkedListEntry<Landmark>{
|
||||
'location': List<dynamic> location,
|
||||
'type': String type,
|
||||
}) {
|
||||
// refine the parsing on a few
|
||||
// refine the parsing on a few fields
|
||||
List<double> locationFixed = List<double>.from(location);
|
||||
// parse the rest separately, they could be missing
|
||||
LandmarkType typeFixed = LandmarkType(name: type);
|
||||
@@ -106,6 +107,14 @@ class LandmarkType {
|
||||
// required this.description,
|
||||
// required this.icon,
|
||||
});
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (other is LandmarkType) {
|
||||
return name == other.name;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user