34 lines
721 B
Dart
34 lines
721 B
Dart
|
|
class Position {
|
|
final double latitude;
|
|
final double longitude;
|
|
|
|
Position({this.latitude, this.longitude});
|
|
|
|
@override
|
|
bool operator ==(other) {
|
|
var areEqual = other is Position &&
|
|
other.latitude == latitude &&
|
|
other.longitude == longitude;
|
|
|
|
return areEqual;
|
|
}
|
|
|
|
@override
|
|
int get hashCode => latitude.hashCode ^
|
|
longitude.hashCode;
|
|
|
|
@override
|
|
String toString() {
|
|
return 'Lat $latitude, Lng $longitude';
|
|
}
|
|
|
|
Position.fromJson(Map<String, dynamic> json) :
|
|
latitude = double.parse(json['latitude'].toString()),
|
|
longitude = double.parse(json['longitude'].toString());
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'latitude': latitude,
|
|
'longitude': longitude
|
|
};
|
|
} |