import 'package:sport/services/Converter.dart'; class Location { double latitude; double longitude; final double? altitude; final double? speed; /// 地址 final String? address; /// 国家 final String? country; /// 省 final String? province; /// 市 final String? city; final String? citycode; final String? adcode; /// 区 final String? district; /// 街道 final String? street; /// 精准度 [在web端直接返回0] final double? accuracy; final double? bearing; final int? locationType; int? state; int? time; int? step; Location({ this.latitude =0, this.longitude=0, this.accuracy, this.altitude, this.speed, this.address, this.city, this.country, this.district, this.street, this.province, this.bearing, this.citycode,this.adcode,this.state,this.time,this.step, this.locationType }); factory Location.fromJson(Map json) => _$LocationFromJson(json); Map toJson() => _$LocationToJson(this); Location copyWith({ double? latitude, double? longitude, double? altitude, double? speed, String? address, String? country, String? province, String? city, String? citycode, String? adcode, String? district, String? street, double? accuracy, int? state, int? time, int? step, double? bearing, int? locationType, }) { return new Location( latitude: latitude ?? this.latitude, longitude: longitude ?? this.longitude, altitude: altitude ?? this.altitude, speed: speed ?? this.speed, address: address ?? this.address, country: country ?? this.country, province: province ?? this.province, city: city ?? this.city, citycode: citycode ?? this.citycode, adcode: adcode ?? this.adcode, district: district ?? this.district, street: street ?? this.street, accuracy: accuracy ?? this.accuracy, state: state ?? this.state, time: time ?? this.time, step: step ?? this.step, bearing: bearing ?? this.bearing, locationType: locationType ?? this.locationType, ); } } Location _$LocationFromJson(Map json) { return Location( latitude: Converter.toDouble(json['latitude']), longitude: Converter.toDouble(json['longitude']), accuracy: Converter.toDouble(json['accuracy']), altitude: Converter.toDouble(json['altitude']), address: json['address'] as String, city: json['city'] as String, country: json['country'] as String, district: json['district'] as String, street: json['street'] as String, province: json['province'] as String, citycode: json['cityCode'] as String, adcode: json['adCode'] as String, speed: Converter.toDouble(json['speed']), step: Converter.toInt(json['step']), state: Converter.toInt(json['state']), time: Converter.toInt(json['time']), bearing: Converter.toDouble(json['bearing']), locationType: Converter.toInt(json['locationType']), ); } Map _$LocationToJson(Location instance) => { 'latitude': instance.latitude, 'longitude': instance.longitude, 'accuracy': instance.accuracy, 'bearing': instance.bearing, 'locationType': instance.locationType, 'speed': instance.speed, };