592 lines
19 KiB
Dart
592 lines
19 KiB
Dart
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
|
import 'dart:convert';
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
import 'package:unicode/unicode.dart';
|
|
|
|
class LocationResponse {
|
|
List<Feature>? features;
|
|
String? type;
|
|
|
|
LocationResponse({
|
|
this.features,
|
|
this.type,
|
|
});
|
|
|
|
LocationResponse copyWith({
|
|
List<Feature>? features,
|
|
String? type,
|
|
}) {
|
|
return LocationResponse(
|
|
features: features ?? this.features,
|
|
type: type ?? this.type,
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toMap() {
|
|
return {
|
|
'features': features?.map((x) => x.toMap()).toList(),
|
|
'type': type,
|
|
};
|
|
}
|
|
|
|
factory LocationResponse.fromMap(Map<String, dynamic> map) {
|
|
return LocationResponse(
|
|
features: List<Feature>.from(map['features']?.map((x) => Feature.fromMap(x)) ?? const []),
|
|
type: map['type'],
|
|
);
|
|
}
|
|
|
|
String toJson() => json.encode(toMap());
|
|
|
|
factory LocationResponse.fromJson(String source) =>
|
|
LocationResponse.fromMap(json.decode(source));
|
|
|
|
@override
|
|
String toString() => 'LocationResponse(features: $features, type: $type)';
|
|
|
|
@override
|
|
bool operator ==(Object other) {
|
|
if (identical(this, other)) return true;
|
|
|
|
return other is LocationResponse &&
|
|
listEquals(other.features, features) &&
|
|
other.type == type;
|
|
}
|
|
|
|
@override
|
|
int get hashCode => features.hashCode ^ type.hashCode;
|
|
}
|
|
|
|
class Feature {
|
|
Geometry? geometry;
|
|
int? id;
|
|
Properties? properties;
|
|
String? type;
|
|
int? location_id;
|
|
double? latitude;
|
|
double? longitude;
|
|
|
|
Feature({
|
|
this.geometry,
|
|
this.id,
|
|
this.properties,
|
|
this.type,
|
|
this.location_id,
|
|
this.latitude,
|
|
this.longitude
|
|
});
|
|
|
|
|
|
Map<String, dynamic> toMap() {
|
|
return <String, dynamic>{
|
|
'id': id,
|
|
'geometry': geometry?.toJson(),
|
|
'properties': properties?.toJson(),
|
|
'type': type,
|
|
// Use the first coordinate as latitude and longitude.
|
|
// You may need to adjust this based on your actual data structure.
|
|
'location_id': properties?.location_id,
|
|
'latitude': geometry?.coordinates?.first?.last,
|
|
'longitude': geometry?.coordinates?.first?.first,
|
|
};
|
|
}
|
|
|
|
// factory Feature.fromMap(Map<String, dynamic> map) {
|
|
// return Feature(
|
|
// geometry: Geometry.fromMap(map['geometry']),
|
|
// id: map['id'],
|
|
// properties: Properties.fromMap(map['properties']),
|
|
// type: map['type'],
|
|
// );
|
|
// }
|
|
|
|
factory Feature.fromMap(Map<String, dynamic> map) {
|
|
Geometry? geometry = map['geometry'] != null
|
|
? Geometry.fromMap(map['geometry'])
|
|
: null;
|
|
double? latitude = geometry?.coordinates?.isNotEmpty ?? false ? geometry!.coordinates![0][0] : null;
|
|
double? longitude = geometry?.coordinates?.isNotEmpty ?? false ? geometry!.coordinates![0][1] : null;
|
|
|
|
return Feature(
|
|
id: map['id'] as int?,
|
|
geometry: Geometry.fromMap(map['geometry']),
|
|
properties: Properties.fromMap(map['properties']),
|
|
type: map['type'],
|
|
location_id: Properties.fromMap(map['properties']).location_id,
|
|
latitude: latitude,
|
|
longitude: longitude,
|
|
);
|
|
}
|
|
|
|
|
|
String toJson() => json.encode(toMap());
|
|
|
|
factory Feature.fromJson(String source) =>
|
|
Feature.fromMap(json.decode(source));
|
|
|
|
@override
|
|
String toString() {
|
|
return 'Feature(geometry: $geometry, id: $id, properties: $properties, type: $type)';
|
|
}
|
|
|
|
@override
|
|
bool operator ==(Object other) {
|
|
if (identical(this, other)) return true;
|
|
|
|
return other is Feature &&
|
|
other.geometry == geometry &&
|
|
other.id == id &&
|
|
other.properties == properties &&
|
|
other.type == type;
|
|
}
|
|
|
|
@override
|
|
int get hashCode {
|
|
return geometry.hashCode ^ id.hashCode ^ properties.hashCode ^ type.hashCode;
|
|
}
|
|
}
|
|
|
|
class Geometry {
|
|
List<List<double>>? coordinates;
|
|
String? type;
|
|
|
|
Geometry({
|
|
this.coordinates,
|
|
this.type,
|
|
});
|
|
|
|
Geometry copyWith({
|
|
List<List<double>>? coordinates,
|
|
String? type,
|
|
}) {
|
|
return Geometry(
|
|
coordinates: coordinates ?? this.coordinates,
|
|
type: type ?? this.type,
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toMap() {
|
|
return {
|
|
'coordinates': coordinates,
|
|
'type': type,
|
|
};
|
|
}
|
|
|
|
factory Geometry.fromMap(Map<String, dynamic> map) {
|
|
return Geometry(
|
|
coordinates: map['coordinates'] != null
|
|
? List<List<double>>.from(
|
|
map['coordinates'].map((x) => List<double>.from(x.map((x) => x.toDouble()))))
|
|
: null,
|
|
type: map['type'],
|
|
);
|
|
}
|
|
|
|
String toJson() => json.encode(toMap());
|
|
|
|
factory Geometry.fromJson(String source) =>
|
|
Geometry.fromMap(json.decode(source) as Map<String, dynamic>);
|
|
|
|
@override
|
|
String toString() => 'Geometry(coordinates: $coordinates, type: $type)';
|
|
|
|
@override
|
|
bool operator ==(covariant Geometry other) {
|
|
if (identical(this, other)) return true;
|
|
|
|
return listEquals(other.coordinates, coordinates) && other.type == type;
|
|
}
|
|
|
|
@override
|
|
int get hashCode => coordinates.hashCode ^ type.hashCode;
|
|
}
|
|
|
|
class Properties {
|
|
final int location_id;
|
|
final String? sub_loc_id;
|
|
final double? cp;
|
|
final String? location_name;
|
|
final String? category;
|
|
final String? subcategory;
|
|
final String? zip;
|
|
final String? address;
|
|
final String? prefecture;
|
|
final String? area;
|
|
final String? city;
|
|
final double? latitude;
|
|
final double? longitude;
|
|
final String? photos;
|
|
final String? videos;
|
|
final String? webcontents;
|
|
final String? status;
|
|
final String? portal;
|
|
final String? group;
|
|
final String? phone;
|
|
final String? fax;
|
|
final String? email;
|
|
final String? facility;
|
|
final String? remark;
|
|
final String? tags;
|
|
final dynamic? event_name;
|
|
final bool? event_active;
|
|
final bool? hidden_location;
|
|
final bool? auto_checkin;
|
|
final double? checkin_radius;
|
|
final double? checkin_point;
|
|
final double? buy_point;
|
|
final String? evaluation_value;
|
|
final bool? shop_closed;
|
|
final bool? shop_shutdown;
|
|
final String? opening_hours_mon;
|
|
final String? opening_hours_tue;
|
|
final String? opening_hours_wed;
|
|
final String? opening_hours_thu;
|
|
final String? opening_hours_fri;
|
|
final String? opening_hours_sat;
|
|
final String? opening_hours_sun;
|
|
final String? parammeters;
|
|
Properties({
|
|
required this.location_id,
|
|
this.sub_loc_id,
|
|
this.cp,
|
|
this.location_name,
|
|
this.category,
|
|
this.subcategory,
|
|
this.zip,
|
|
this.address,
|
|
this.prefecture,
|
|
this.area,
|
|
this.city,
|
|
this.latitude,
|
|
this.longitude,
|
|
this.photos,
|
|
this.videos,
|
|
this.webcontents,
|
|
this.status,
|
|
this.portal,
|
|
this.group,
|
|
this.phone,
|
|
this.fax,
|
|
this.email,
|
|
this.facility,
|
|
this.remark,
|
|
this.tags,
|
|
this.event_name,
|
|
this.event_active,
|
|
this.hidden_location,
|
|
this.auto_checkin,
|
|
this.checkin_radius,
|
|
this.checkin_point,
|
|
this.buy_point,
|
|
this.evaluation_value,
|
|
this.shop_closed,
|
|
this.shop_shutdown,
|
|
this.opening_hours_mon,
|
|
this.opening_hours_tue,
|
|
this.opening_hours_wed,
|
|
this.opening_hours_thu,
|
|
this.opening_hours_fri,
|
|
this.opening_hours_sat,
|
|
this.opening_hours_sun,
|
|
this.parammeters,
|
|
});
|
|
|
|
|
|
String toJson() => json.encode(toMap());
|
|
|
|
Properties copyWith({
|
|
int? location_id,
|
|
String? sub_loc_id,
|
|
double? cp,
|
|
String? location_name,
|
|
String? category,
|
|
String? subcategory,
|
|
String? zip,
|
|
String? address,
|
|
String? prefecture,
|
|
String? area,
|
|
String? city,
|
|
double? latitude,
|
|
double? longitude,
|
|
String? photos,
|
|
String? videos,
|
|
String? webcontents,
|
|
String? status,
|
|
String? portal,
|
|
String? group,
|
|
String? phone,
|
|
String? fax,
|
|
String? email,
|
|
String? facility,
|
|
String? remark,
|
|
String? tags,
|
|
dynamic? event_name,
|
|
bool? event_active,
|
|
bool? hidden_location,
|
|
bool? auto_checkin,
|
|
double? checkin_radius,
|
|
double? checkin_point,
|
|
double? buy_point,
|
|
String? evaluation_value,
|
|
bool? shop_closed,
|
|
bool? shop_shutdown,
|
|
String? opening_hours_mon,
|
|
String? opening_hours_tue,
|
|
String? opening_hours_wed,
|
|
String? opening_hours_thu,
|
|
String? opening_hours_fri,
|
|
String? opening_hours_sat,
|
|
String? opening_hours_sun,
|
|
String? parammeters,
|
|
}) {
|
|
return Properties(
|
|
location_id: location_id ?? this.location_id,
|
|
sub_loc_id: sub_loc_id ?? this.sub_loc_id,
|
|
cp: cp ?? this.cp,
|
|
location_name: location_name ?? this.location_name,
|
|
category: category ?? this.category,
|
|
subcategory: subcategory ?? this.subcategory,
|
|
zip: zip ?? this.zip,
|
|
address: address ?? this.address,
|
|
prefecture: prefecture ?? this.prefecture,
|
|
area: area ?? this.area,
|
|
city: city ?? this.city,
|
|
latitude: latitude ?? this.latitude,
|
|
longitude: longitude ?? this.longitude,
|
|
photos: photos ?? this.photos,
|
|
videos: videos ?? this.videos,
|
|
webcontents: webcontents ?? this.webcontents,
|
|
status: status ?? this.status,
|
|
portal: portal ?? this.portal,
|
|
group: group ?? this.group,
|
|
phone: phone ?? this.phone,
|
|
fax: fax ?? this.fax,
|
|
email: email ?? this.email,
|
|
facility: facility ?? this.facility,
|
|
remark: remark ?? this.remark,
|
|
tags: tags ?? this.tags,
|
|
event_name: event_name ?? this.event_name,
|
|
event_active: event_active ?? this.event_active,
|
|
hidden_location: hidden_location ?? this.hidden_location,
|
|
auto_checkin: auto_checkin ?? this.auto_checkin,
|
|
checkin_radius: checkin_radius ?? this.checkin_radius,
|
|
checkin_point: checkin_point ?? this.checkin_point,
|
|
buy_point: buy_point ?? this.buy_point,
|
|
evaluation_value: evaluation_value ?? this.evaluation_value,
|
|
shop_closed: shop_closed ?? this.shop_closed,
|
|
shop_shutdown: shop_shutdown ?? this.shop_shutdown,
|
|
opening_hours_mon: opening_hours_mon ?? this.opening_hours_mon,
|
|
opening_hours_tue: opening_hours_tue ?? this.opening_hours_tue,
|
|
opening_hours_wed: opening_hours_wed ?? this.opening_hours_wed,
|
|
opening_hours_thu: opening_hours_thu ?? this.opening_hours_thu,
|
|
opening_hours_fri: opening_hours_fri ?? this.opening_hours_fri,
|
|
opening_hours_sat: opening_hours_sat ?? this.opening_hours_sat,
|
|
opening_hours_sun: opening_hours_sun ?? this.opening_hours_sun,
|
|
parammeters: parammeters ?? this.parammeters,
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toMap() {
|
|
return <String, dynamic>{
|
|
'location_id': location_id,
|
|
'sub_loc_id': sub_loc_id,
|
|
'cp': cp,
|
|
'location_name': location_name,
|
|
'category': category,
|
|
'subcategory': subcategory,
|
|
'zip': zip,
|
|
'address': address,
|
|
'prefecture': prefecture,
|
|
'area': area,
|
|
'city': city,
|
|
'latitude': latitude,
|
|
'longitude': longitude,
|
|
'photos': photos,
|
|
'videos': videos,
|
|
'webcontents': webcontents,
|
|
'status': status,
|
|
'portal': portal,
|
|
'group': group,
|
|
'phone': phone,
|
|
'fax': fax,
|
|
'email': email,
|
|
'facility': facility,
|
|
'remark': remark,
|
|
'tags': tags,
|
|
'event_name': event_name,
|
|
'event_active': event_active,
|
|
'hidden_location': hidden_location,
|
|
'auto_checkin': auto_checkin,
|
|
'checkin_radius': checkin_radius,
|
|
'checkin_point': checkin_point,
|
|
'buy_point': buy_point,
|
|
'evaluation_value': evaluation_value,
|
|
'shop_closed': shop_closed,
|
|
'shop_shutdown': shop_shutdown,
|
|
'opening_hours_mon': opening_hours_mon,
|
|
'opening_hours_tue': opening_hours_tue,
|
|
'opening_hours_wed': opening_hours_wed,
|
|
'opening_hours_thu': opening_hours_thu,
|
|
'opening_hours_fri': opening_hours_fri,
|
|
'opening_hours_sat': opening_hours_sat,
|
|
'opening_hours_sun': opening_hours_sun,
|
|
'parammeters': parammeters,
|
|
};
|
|
}
|
|
|
|
factory Properties.fromMap(Map<String, dynamic> map) {
|
|
return Properties(
|
|
location_id: map['location_id'] as int,
|
|
sub_loc_id: map['sub_loc_id'] != null ? map['sub_loc_id'] as String : null,
|
|
cp: map['cp'] != null ? map['cp'] as double : null,
|
|
location_name: map['location_name'] != null ? map['location_name'] as String : null,
|
|
category: map['category'] != null ? map['category'] as String : null,
|
|
subcategory: map['subcategory'] != null ? map['subcategory'] as String : null,
|
|
zip: map['zip'] != null ? map['zip'] as String : null,
|
|
address: map['address'] != null ? map['address'] as String : null,
|
|
prefecture: map['prefecture'] != null ? map['prefecture'] as String : null,
|
|
area: map['area'] != null ? map['area'] as String : null,
|
|
city: map['city'] != null ? map['city'] as String : null,
|
|
latitude: map['latitude'] != null ? map['latitude'] as double : null,
|
|
longitude: map['longitude'] != null ? map['longitude'] as double : null,
|
|
photos: map['photos'] != null ? map['photos'] as String : null,
|
|
videos: map['videos'] != null ? map['videos'] as String : null,
|
|
webcontents: map['webcontents'] != null ? map['webcontents'] as String : null,
|
|
status: map['status'] != null ? map['status'] as String : null,
|
|
portal: map['portal'] != null ? map['portal'] as String : null,
|
|
group: map['group'] != null ? map['group'] as String : null,
|
|
phone: map['phone'] != null ? map['phone'] as String : null,
|
|
fax: map['fax'] != null ? map['fax'] as String : null,
|
|
email: map['email'] != null ? map['email'] as String : null,
|
|
facility: map['facility'] != null ? map['facility'] as String : null,
|
|
remark: map['remark'] != null ? map['remark'] as String : null,
|
|
tags: map['tags'] != null ? map['tags'] as String : null,
|
|
event_name: map['event_name'] != null ? map['event_name'] as dynamic : null,
|
|
event_active: map['event_active'] != null ? map['event_active'] as bool : null,
|
|
hidden_location: map['hidden_location'] != null ? map['hidden_location'] as bool : null,
|
|
auto_checkin: map['auto_checkin'] != null ? map['auto_checkin'] as bool : null,
|
|
checkin_radius: map['checkin_radius'] != null ? map['checkin_radius'] as double : null,
|
|
checkin_point: map['checkin_point'] != null ? map['checkin_point'] as double : null,
|
|
buy_point: map['buy_point'] != null ? map['buy_point'] as double : null,
|
|
evaluation_value: map['evaluation_value'] != null ? map['evaluation_value'] as String : null,
|
|
shop_closed: map['shop_closed'] != null ? map['shop_closed'] as bool : null,
|
|
shop_shutdown: map['shop_shutdown'] != null ? map['shop_shutdown'] as bool : null,
|
|
opening_hours_mon: map['opening_hours_mon'] != null ? map['opening_hours_mon'] as String : null,
|
|
opening_hours_tue: map['opening_hours_tue'] != null ? map['opening_hours_tue'] as String : null,
|
|
opening_hours_wed: map['opening_hours_wed'] != null ? map['opening_hours_wed'] as String : null,
|
|
opening_hours_thu: map['opening_hours_thu'] != null ? map['opening_hours_thu'] as String : null,
|
|
opening_hours_fri: map['opening_hours_fri'] != null ? map['opening_hours_fri'] as String : null,
|
|
opening_hours_sat: map['opening_hours_sat'] != null ? map['opening_hours_sat'] as String : null,
|
|
opening_hours_sun: map['opening_hours_sun'] != null ? map['opening_hours_sun'] as String : null,
|
|
parammeters: map['parammeters'] != null ? map['parammeters'] as String : null,
|
|
);
|
|
}
|
|
|
|
factory Properties.fromJson(String source) => Properties.fromMap(json.decode(source) as Map<String, dynamic>);
|
|
|
|
@override
|
|
String toString() {
|
|
return 'Properties(location_id: $location_id, sub_loc_id: $sub_loc_id, cp: $cp, location_name: $location_name, category: $category, subcategory: $subcategory, zip: $zip, address: $address, prefecture: $prefecture, area: $area, city: $city, latitude: $latitude, longitude: $longitude, photos: $photos, videos: $videos, webcontents: $webcontents, status: $status, portal: $portal, group: $group, phone: $phone, fax: $fax, email: $email, facility: $facility, remark: $remark, tags: $tags, event_name: $event_name, event_active: $event_active, hidden_location: $hidden_location, auto_checkin: $auto_checkin, checkin_radius: $checkin_radius, checkin_point: $checkin_point, buy_point: $buy_point, evaluation_value: $evaluation_value, shop_closed: $shop_closed, shop_shutdown: $shop_shutdown, opening_hours_mon: $opening_hours_mon, opening_hours_tue: $opening_hours_tue, opening_hours_wed: $opening_hours_wed, opening_hours_thu: $opening_hours_thu, opening_hours_fri: $opening_hours_fri, opening_hours_sat: $opening_hours_sat, opening_hours_sun: $opening_hours_sun, parammeters: $parammeters)';
|
|
}
|
|
|
|
@override
|
|
bool operator ==(covariant Properties other) {
|
|
if (identical(this, other)) return true;
|
|
|
|
return
|
|
other.location_id == location_id &&
|
|
other.sub_loc_id == sub_loc_id &&
|
|
other.cp == cp &&
|
|
other.location_name == location_name &&
|
|
other.category == category &&
|
|
other.subcategory == subcategory &&
|
|
other.zip == zip &&
|
|
other.address == address &&
|
|
other.prefecture == prefecture &&
|
|
other.area == area &&
|
|
other.city == city &&
|
|
other.latitude == latitude &&
|
|
other.longitude == longitude &&
|
|
other.photos == photos &&
|
|
other.videos == videos &&
|
|
other.webcontents == webcontents &&
|
|
other.status == status &&
|
|
other.portal == portal &&
|
|
other.group == group &&
|
|
other.phone == phone &&
|
|
other.fax == fax &&
|
|
other.email == email &&
|
|
other.facility == facility &&
|
|
other.remark == remark &&
|
|
other.tags == tags &&
|
|
other.event_name == event_name &&
|
|
other.event_active == event_active &&
|
|
other.hidden_location == hidden_location &&
|
|
other.auto_checkin == auto_checkin &&
|
|
other.checkin_radius == checkin_radius &&
|
|
other.checkin_point == checkin_point &&
|
|
other.buy_point == buy_point &&
|
|
other.evaluation_value == evaluation_value &&
|
|
other.shop_closed == shop_closed &&
|
|
other.shop_shutdown == shop_shutdown &&
|
|
other.opening_hours_mon == opening_hours_mon &&
|
|
other.opening_hours_tue == opening_hours_tue &&
|
|
other.opening_hours_wed == opening_hours_wed &&
|
|
other.opening_hours_thu == opening_hours_thu &&
|
|
other.opening_hours_fri == opening_hours_fri &&
|
|
other.opening_hours_sat == opening_hours_sat &&
|
|
other.opening_hours_sun == opening_hours_sun &&
|
|
other.parammeters == parammeters;
|
|
}
|
|
|
|
@override
|
|
int get hashCode {
|
|
return location_id.hashCode ^
|
|
sub_loc_id.hashCode ^
|
|
cp.hashCode ^
|
|
location_name.hashCode ^
|
|
category.hashCode ^
|
|
subcategory.hashCode ^
|
|
zip.hashCode ^
|
|
address.hashCode ^
|
|
prefecture.hashCode ^
|
|
area.hashCode ^
|
|
city.hashCode ^
|
|
latitude.hashCode ^
|
|
longitude.hashCode ^
|
|
photos.hashCode ^
|
|
videos.hashCode ^
|
|
webcontents.hashCode ^
|
|
status.hashCode ^
|
|
portal.hashCode ^
|
|
group.hashCode ^
|
|
phone.hashCode ^
|
|
fax.hashCode ^
|
|
email.hashCode ^
|
|
facility.hashCode ^
|
|
remark.hashCode ^
|
|
tags.hashCode ^
|
|
event_name.hashCode ^
|
|
event_active.hashCode ^
|
|
hidden_location.hashCode ^
|
|
auto_checkin.hashCode ^
|
|
checkin_radius.hashCode ^
|
|
checkin_point.hashCode ^
|
|
buy_point.hashCode ^
|
|
evaluation_value.hashCode ^
|
|
shop_closed.hashCode ^
|
|
shop_shutdown.hashCode ^
|
|
opening_hours_mon.hashCode ^
|
|
opening_hours_tue.hashCode ^
|
|
opening_hours_wed.hashCode ^
|
|
opening_hours_thu.hashCode ^
|
|
opening_hours_fri.hashCode ^
|
|
opening_hours_sat.hashCode ^
|
|
opening_hours_sun.hashCode ^
|
|
parammeters.hashCode;
|
|
}
|
|
}
|
|
|
|
|