From 607718a9bb0e8d8a1f0c2901910e170130c2f683 Mon Sep 17 00:00:00 2001 From: Benji Date: Sun, 26 Mar 2023 10:33:30 +1300 Subject: [PATCH] Add extra fields to PlaceDetails and generate generated files --- lib/src/core.dart | 36 +-- lib/src/core.g.dart | 161 +++++------- lib/src/directions.g.dart | 334 ++++++++++------------- lib/src/distance.g.dart | 71 +++-- lib/src/geocoding.g.dart | 91 ++++--- lib/src/geolocation.g.dart | 92 +++---- lib/src/places.dart | 87 ++++++ lib/src/places.g.dart | 524 +++++++++++++++++++------------------ lib/src/timezone.g.dart | 21 +- 9 files changed, 704 insertions(+), 713 deletions(-) diff --git a/lib/src/core.dart b/lib/src/core.dart index a01c078..c11cea3 100644 --- a/lib/src/core.dart +++ b/lib/src/core.dart @@ -161,13 +161,13 @@ class _TravelMode { // ignore: unused_element factory _TravelMode.fromJson(Map json) => - _$_TravelModeFromJson(json); - Map toJson() => _$_TravelModeToJson(this); + _$TravelModeFromJson(json); + Map toJson() => _$TravelModeToJson(this); } extension TravelModeExt on TravelMode { static TravelMode fromApiString(String mode) { - return _$enumDecode(_$TravelModeEnumMap, mode); + return $enumDecode(_$TravelModeEnumMap, mode); } String toApiString() { @@ -190,13 +190,13 @@ class _RouteType { // ignore: unused_element factory _RouteType.fromJson(Map json) => - _$_RouteTypeFromJson(json); - Map toJson() => _$_RouteTypeToJson(this); + _$RouteTypeFromJson(json); + Map toJson() => _$RouteTypeToJson(this); } extension RouteTypeExt on RouteType { static RouteType fromApiString(String mode) { - return _$enumDecode(_$RouteTypeEnumMap, mode); + return $enumDecode(_$RouteTypeEnumMap, mode); } String toApiString() { @@ -216,13 +216,13 @@ class _Unit { _Unit(this.value); // ignore: unused_element - factory _Unit.fromJson(Map json) => _$_UnitFromJson(json); - Map toJson() => _$_UnitToJson(this); + factory _Unit.fromJson(Map json) => _$UnitFromJson(json); + Map toJson() => _$UnitToJson(this); } extension UnitExt on Unit { static Unit fromApiString(String mode) { - return _$enumDecode(_$UnitEnumMap, mode); + return $enumDecode(_$UnitEnumMap, mode); } String toApiString() { @@ -245,13 +245,13 @@ class _TrafficModel { // ignore: unused_element factory _TrafficModel.fromJson(Map json) => - _$_TrafficModelFromJson(json); - Map toJson() => _$_TrafficModelToJson(this); + _$TrafficModelFromJson(json); + Map toJson() => _$TrafficModelToJson(this); } extension TrafficModelExt on TrafficModel { static TrafficModel fromApiString(String mode) { - return _$enumDecode(_$TrafficModelEnumMap, mode); + return $enumDecode(_$TrafficModelEnumMap, mode); } String toApiString() { @@ -275,13 +275,13 @@ class _TransitMode { // ignore: unused_element factory _TransitMode.fromJson(Map json) => - _$_TransitModeFromJson(json); - Map toJson() => _$_TransitModeToJson(this); + _$TransitModeFromJson(json); + Map toJson() => _$TransitModeToJson(this); } extension TransitModeExt on TransitMode { static TransitMode fromApiString(String mode) { - return _$enumDecode(_$TransitModeEnumMap, mode); + return $enumDecode(_$TransitModeEnumMap, mode); } String toApiString() { @@ -304,13 +304,13 @@ class _TransitRoutingPreferences { // ignore: unused_element factory _TransitRoutingPreferences.fromJson(Map json) => - _$_TransitRoutingPreferencesFromJson(json); - Map toJson() => _$_TransitRoutingPreferencesToJson(this); + _$TransitRoutingPreferencesFromJson(json); + Map toJson() => _$TransitRoutingPreferencesToJson(this); } extension TransitRoutingPreferencesExt on TransitRoutingPreferences { static TransitRoutingPreferences fromApiString(String mode) { - return _$enumDecode(_$TransitRoutingPreferencesEnumMap, mode); + return $enumDecode(_$TransitRoutingPreferencesEnumMap, mode); } String toApiString() { diff --git a/lib/src/core.g.dart b/lib/src/core.g.dart index 7673fe1..b456d19 100644 --- a/lib/src/core.g.dart +++ b/lib/src/core.g.dart @@ -6,30 +6,26 @@ part of 'core.dart'; // JsonSerializableGenerator // ************************************************************************** -Location _$LocationFromJson(Map json) { - return Location( - lat: (json['lat'] as num).toDouble(), - lng: (json['lng'] as num).toDouble(), - ); -} +Location _$LocationFromJson(Map json) => Location( + lat: (json['lat'] as num).toDouble(), + lng: (json['lng'] as num).toDouble(), + ); Map _$LocationToJson(Location instance) => { 'lat': instance.lat, 'lng': instance.lng, }; -Geometry _$GeometryFromJson(Map json) { - return Geometry( - location: Location.fromJson(json['location'] as Map), - locationType: json['location_type'] as String?, - viewport: json['viewport'] == null - ? null - : Bounds.fromJson(json['viewport'] as Map), - bounds: json['bounds'] == null - ? null - : Bounds.fromJson(json['bounds'] as Map), - ); -} +Geometry _$GeometryFromJson(Map json) => Geometry( + location: Location.fromJson(json['location'] as Map), + locationType: json['location_type'] as String?, + viewport: json['viewport'] == null + ? null + : Bounds.fromJson(json['viewport'] as Map), + bounds: json['bounds'] == null + ? null + : Bounds.fromJson(json['bounds'] as Map), + ); Map _$GeometryToJson(Geometry instance) => { 'location': instance.location, @@ -38,27 +34,24 @@ Map _$GeometryToJson(Geometry instance) => { 'bounds': instance.bounds, }; -Bounds _$BoundsFromJson(Map json) { - return Bounds( - northeast: Location.fromJson(json['northeast'] as Map), - southwest: Location.fromJson(json['southwest'] as Map), - ); -} +Bounds _$BoundsFromJson(Map json) => Bounds( + northeast: Location.fromJson(json['northeast'] as Map), + southwest: Location.fromJson(json['southwest'] as Map), + ); Map _$BoundsToJson(Bounds instance) => { 'northeast': instance.northeast, 'southwest': instance.southwest, }; -AddressComponent _$AddressComponentFromJson(Map json) { - return AddressComponent( - types: - (json['types'] as List?)?.map((e) => e as String).toList() ?? - [], - longName: json['long_name'] as String, - shortName: json['short_name'] as String, - ); -} +AddressComponent _$AddressComponentFromJson(Map json) => + AddressComponent( + types: + (json['types'] as List?)?.map((e) => e as String).toList() ?? + [], + longName: json['long_name'] as String, + shortName: json['short_name'] as String, + ); Map _$AddressComponentToJson(AddressComponent instance) => { @@ -67,43 +60,15 @@ Map _$AddressComponentToJson(AddressComponent instance) => 'short_name': instance.shortName, }; -_TravelMode _$_TravelModeFromJson(Map json) { - return _TravelMode( - _$enumDecode(_$TravelModeEnumMap, json['value']), - ); -} +_TravelMode _$TravelModeFromJson(Map json) => _TravelMode( + $enumDecode(_$TravelModeEnumMap, json['value']), + ); -Map _$_TravelModeToJson(_TravelMode instance) => +Map _$TravelModeToJson(_TravelMode instance) => { - 'value': _$TravelModeEnumMap[instance.value], + 'value': _$TravelModeEnumMap[instance.value]!, }; -K _$enumDecode( - Map enumValues, - Object? source, { - K? unknownValue, -}) { - if (source == null) { - throw ArgumentError( - 'A value must be provided. Supported values: ' - '${enumValues.values.join(', ')}', - ); - } - - return enumValues.entries.singleWhere( - (e) => e.value == source, - orElse: () { - if (unknownValue == null) { - throw ArgumentError( - '`$source` is not one of the supported values: ' - '${enumValues.values.join(', ')}', - ); - } - return MapEntry(unknownValue, enumValues.values.first); - }, - ).key; -} - const _$TravelModeEnumMap = { TravelMode.driving: 'DRIVING', TravelMode.walking: 'WALKING', @@ -111,15 +76,13 @@ const _$TravelModeEnumMap = { TravelMode.transit: 'TRANSIT', }; -_RouteType _$_RouteTypeFromJson(Map json) { - return _RouteType( - _$enumDecode(_$RouteTypeEnumMap, json['value']), - ); -} +_RouteType _$RouteTypeFromJson(Map json) => _RouteType( + $enumDecode(_$RouteTypeEnumMap, json['value']), + ); -Map _$_RouteTypeToJson(_RouteType instance) => +Map _$RouteTypeToJson(_RouteType instance) => { - 'value': _$RouteTypeEnumMap[instance.value], + 'value': _$RouteTypeEnumMap[instance.value]!, }; const _$RouteTypeEnumMap = { @@ -129,14 +92,12 @@ const _$RouteTypeEnumMap = { RouteType.indoor: 'indoor', }; -_Unit _$_UnitFromJson(Map json) { - return _Unit( - _$enumDecode(_$UnitEnumMap, json['value']), - ); -} +_Unit _$UnitFromJson(Map json) => _Unit( + $enumDecode(_$UnitEnumMap, json['value']), + ); -Map _$_UnitToJson(_Unit instance) => { - 'value': _$UnitEnumMap[instance.value], +Map _$UnitToJson(_Unit instance) => { + 'value': _$UnitEnumMap[instance.value]!, }; const _$UnitEnumMap = { @@ -144,15 +105,14 @@ const _$UnitEnumMap = { Unit.imperial: 'imperial', }; -_TrafficModel _$_TrafficModelFromJson(Map json) { - return _TrafficModel( - _$enumDecode(_$TrafficModelEnumMap, json['value']), - ); -} +_TrafficModel _$TrafficModelFromJson(Map json) => + _TrafficModel( + $enumDecode(_$TrafficModelEnumMap, json['value']), + ); -Map _$_TrafficModelToJson(_TrafficModel instance) => +Map _$TrafficModelToJson(_TrafficModel instance) => { - 'value': _$TrafficModelEnumMap[instance.value], + 'value': _$TrafficModelEnumMap[instance.value]!, }; const _$TrafficModelEnumMap = { @@ -161,15 +121,13 @@ const _$TrafficModelEnumMap = { TrafficModel.optimistic: 'optimistic', }; -_TransitMode _$_TransitModeFromJson(Map json) { - return _TransitMode( - _$enumDecode(_$TransitModeEnumMap, json['value']), - ); -} +_TransitMode _$TransitModeFromJson(Map json) => _TransitMode( + $enumDecode(_$TransitModeEnumMap, json['value']), + ); -Map _$_TransitModeToJson(_TransitMode instance) => +Map _$TransitModeToJson(_TransitMode instance) => { - 'value': _$TransitModeEnumMap[instance.value], + 'value': _$TransitModeEnumMap[instance.value]!, }; const _$TransitModeEnumMap = { @@ -180,17 +138,16 @@ const _$TransitModeEnumMap = { TransitMode.rail: 'rail', }; -_TransitRoutingPreferences _$_TransitRoutingPreferencesFromJson( - Map json) { - return _TransitRoutingPreferences( - _$enumDecode(_$TransitRoutingPreferencesEnumMap, json['value']), - ); -} +_TransitRoutingPreferences _$TransitRoutingPreferencesFromJson( + Map json) => + _TransitRoutingPreferences( + $enumDecode(_$TransitRoutingPreferencesEnumMap, json['value']), + ); -Map _$_TransitRoutingPreferencesToJson( +Map _$TransitRoutingPreferencesToJson( _TransitRoutingPreferences instance) => { - 'value': _$TransitRoutingPreferencesEnumMap[instance.value], + 'value': _$TransitRoutingPreferencesEnumMap[instance.value]!, }; const _$TransitRoutingPreferencesEnumMap = { diff --git a/lib/src/directions.g.dart b/lib/src/directions.g.dart index fe8a0f3..c455b67 100644 --- a/lib/src/directions.g.dart +++ b/lib/src/directions.g.dart @@ -6,20 +6,19 @@ part of 'directions.dart'; // JsonSerializableGenerator // ************************************************************************** -DirectionsResponse _$DirectionsResponseFromJson(Map json) { - return DirectionsResponse( - status: json['status'] as String, - errorMessage: json['error_message'] as String?, - geocodedWaypoints: (json['geocoded_waypoints'] as List?) - ?.map((e) => GeocodedWaypoint.fromJson(e as Map)) - .toList() ?? - [], - routes: (json['routes'] as List?) - ?.map((e) => Route.fromJson(e as Map)) - .toList() ?? - [], - ); -} +DirectionsResponse _$DirectionsResponseFromJson(Map json) => + DirectionsResponse( + status: json['status'] as String, + errorMessage: json['error_message'] as String?, + geocodedWaypoints: (json['geocoded_waypoints'] as List?) + ?.map((e) => GeocodedWaypoint.fromJson(e as Map)) + .toList() ?? + [], + routes: (json['routes'] as List?) + ?.map((e) => Route.fromJson(e as Map)) + .toList() ?? + [], + ); Map _$DirectionsResponseToJson(DirectionsResponse instance) => { @@ -29,26 +28,23 @@ Map _$DirectionsResponseToJson(DirectionsResponse instance) => 'routes': instance.routes, }; -Waypoint _$WaypointFromJson(Map json) { - return Waypoint( - value: json['value'] as String, - ); -} +Waypoint _$WaypointFromJson(Map json) => Waypoint( + value: json['value'] as String, + ); Map _$WaypointToJson(Waypoint instance) => { 'value': instance.value, }; -GeocodedWaypoint _$GeocodedWaypointFromJson(Map json) { - return GeocodedWaypoint( - geocoderStatus: json['geocoder_status'] as String, - placeId: json['place_id'] as String, - types: - (json['types'] as List?)?.map((e) => e as String).toList() ?? - [], - partialMatch: json['partial_match'] as bool? ?? false, - ); -} +GeocodedWaypoint _$GeocodedWaypointFromJson(Map json) => + GeocodedWaypoint( + geocoderStatus: json['geocoder_status'] as String, + placeId: json['place_id'] as String, + types: + (json['types'] as List?)?.map((e) => e as String).toList() ?? + [], + partialMatch: json['partial_match'] as bool? ?? false, + ); Map _$GeocodedWaypointToJson(GeocodedWaypoint instance) => { @@ -58,27 +54,25 @@ Map _$GeocodedWaypointToJson(GeocodedWaypoint instance) => 'partial_match': instance.partialMatch, }; -Route _$RouteFromJson(Map json) { - return Route( - summary: json['summary'] as String, - legs: (json['legs'] as List?) - ?.map((e) => Leg.fromJson(e as Map)) - .toList() ?? - [], - copyrights: json['copyrights'] as String, - overviewPolyline: - Polyline.fromJson(json['overview_polyline'] as Map), - warnings: json['warnings'] as List, - waypointOrder: (json['waypoint_order'] as List?) - ?.map((e) => e as num) - .toList() ?? - [], - bounds: Bounds.fromJson(json['bounds'] as Map), - fare: json['fare'] == null - ? null - : Fare.fromJson(json['fare'] as Map), - ); -} +Route _$RouteFromJson(Map json) => Route( + summary: json['summary'] as String, + legs: (json['legs'] as List?) + ?.map((e) => Leg.fromJson(e as Map)) + .toList() ?? + [], + copyrights: json['copyrights'] as String, + overviewPolyline: + Polyline.fromJson(json['overview_polyline'] as Map), + warnings: json['warnings'] as List, + waypointOrder: (json['waypoint_order'] as List?) + ?.map((e) => e as num) + .toList() ?? + [], + bounds: Bounds.fromJson(json['bounds'] as Map), + fare: json['fare'] == null + ? null + : Fare.fromJson(json['fare'] as Map), + ); Map _$RouteToJson(Route instance) => { 'summary': instance.summary, @@ -91,31 +85,29 @@ Map _$RouteToJson(Route instance) => { 'fare': instance.fare, }; -Leg _$LegFromJson(Map json) { - return Leg( - steps: (json['steps'] as List?) - ?.map((e) => Step.fromJson(e as Map)) - .toList() ?? - [], - startAddress: json['start_address'] as String, - endAddress: json['end_address'] as String, - durationInTraffic: json['duration_in_traffic'] == null - ? null - : Value.fromJson(json['duration_in_traffic'] as Map), - arrivalTime: json['arrival_time'] == null - ? null - : Time.fromJson(json['arrival_time'] as Map), - departureTime: json['departure_time'] == null - ? null - : Time.fromJson(json['departure_time'] as Map), - startLocation: - Location.fromJson(json['start_location'] as Map), - endLocation: - Location.fromJson(json['end_location'] as Map), - duration: Value.fromJson(json['duration'] as Map), - distance: Value.fromJson(json['distance'] as Map), - ); -} +Leg _$LegFromJson(Map json) => Leg( + steps: (json['steps'] as List?) + ?.map((e) => Step.fromJson(e as Map)) + .toList() ?? + [], + startAddress: json['start_address'] as String, + endAddress: json['end_address'] as String, + durationInTraffic: json['duration_in_traffic'] == null + ? null + : Value.fromJson(json['duration_in_traffic'] as Map), + arrivalTime: json['arrival_time'] == null + ? null + : Time.fromJson(json['arrival_time'] as Map), + departureTime: json['departure_time'] == null + ? null + : Time.fromJson(json['departure_time'] as Map), + startLocation: + Location.fromJson(json['start_location'] as Map), + endLocation: + Location.fromJson(json['end_location'] as Map), + duration: Value.fromJson(json['duration'] as Map), + distance: Value.fromJson(json['distance'] as Map), + ); Map _$LegToJson(Leg instance) => { 'start_location': instance.startLocation, @@ -130,63 +122,35 @@ Map _$LegToJson(Leg instance) => { 'departure_time': instance.departureTime, }; -Step _$StepFromJson(Map json) { - return Step( - travelMode: _$enumDecode(_$TravelModeEnumMap, json['travel_mode']), - htmlInstructions: json['html_instructions'] as String, - polyline: Polyline.fromJson(json['polyline'] as Map), - startLocation: - Location.fromJson(json['start_location'] as Map), - endLocation: - Location.fromJson(json['end_location'] as Map), - duration: Value.fromJson(json['duration'] as Map), - distance: Value.fromJson(json['distance'] as Map), - transitDetails: json['transit_details'] == null - ? null - : TransitDetails.fromJson( - json['transit_details'] as Map), - maneuver: json['maneuver'] as String?, - ); -} +Step _$StepFromJson(Map json) => Step( + travelMode: $enumDecode(_$TravelModeEnumMap, json['travel_mode']), + htmlInstructions: json['html_instructions'] as String, + polyline: Polyline.fromJson(json['polyline'] as Map), + startLocation: + Location.fromJson(json['start_location'] as Map), + endLocation: + Location.fromJson(json['end_location'] as Map), + duration: Value.fromJson(json['duration'] as Map), + distance: Value.fromJson(json['distance'] as Map), + transitDetails: json['transit_details'] == null + ? null + : TransitDetails.fromJson( + json['transit_details'] as Map), + maneuver: json['maneuver'] as String?, + ); Map _$StepToJson(Step instance) => { 'start_location': instance.startLocation, 'end_location': instance.endLocation, 'duration': instance.duration, 'distance': instance.distance, - 'travel_mode': _$TravelModeEnumMap[instance.travelMode], + 'travel_mode': _$TravelModeEnumMap[instance.travelMode]!, 'html_instructions': instance.htmlInstructions, 'maneuver': instance.maneuver, 'polyline': instance.polyline, 'transit_details': instance.transitDetails, }; -K _$enumDecode( - Map enumValues, - Object? source, { - K? unknownValue, -}) { - if (source == null) { - throw ArgumentError( - 'A value must be provided. Supported values: ' - '${enumValues.values.join(', ')}', - ); - } - - return enumValues.entries.singleWhere( - (e) => e.value == source, - orElse: () { - if (unknownValue == null) { - throw ArgumentError( - '`$source` is not one of the supported values: ' - '${enumValues.values.join(', ')}', - ); - } - return MapEntry(unknownValue, enumValues.values.first); - }, - ).key; -} - const _$TravelModeEnumMap = { TravelMode.driving: 'DRIVING', TravelMode.walking: 'WALKING', @@ -194,35 +158,29 @@ const _$TravelModeEnumMap = { TravelMode.transit: 'TRANSIT', }; -Polyline _$PolylineFromJson(Map json) { - return Polyline( - points: json['points'] as String, - ); -} +Polyline _$PolylineFromJson(Map json) => Polyline( + points: json['points'] as String, + ); Map _$PolylineToJson(Polyline instance) => { 'points': instance.points, }; -Value _$ValueFromJson(Map json) { - return Value( - value: json['value'] as num, - text: json['text'] as String, - ); -} +Value _$ValueFromJson(Map json) => Value( + value: json['value'] as num, + text: json['text'] as String, + ); Map _$ValueToJson(Value instance) => { 'value': instance.value, 'text': instance.text, }; -Fare _$FareFromJson(Map json) { - return Fare( - currency: json['currency'] as String, - value: json['value'] as num, - text: json['text'] as String, - ); -} +Fare _$FareFromJson(Map json) => Fare( + currency: json['currency'] as String, + value: json['value'] as num, + text: json['text'] as String, + ); Map _$FareToJson(Fare instance) => { 'value': instance.value, @@ -230,13 +188,11 @@ Map _$FareToJson(Fare instance) => { 'currency': instance.currency, }; -Time _$TimeFromJson(Map json) { - return Time( - timeZone: json['time_zone'] as String, - value: json['value'] as num, - text: json['text'] as String, - ); -} +Time _$TimeFromJson(Map json) => Time( + timeZone: json['time_zone'] as String, + value: json['value'] as num, + text: json['text'] as String, + ); Map _$TimeToJson(Time instance) => { 'value': instance.value, @@ -244,19 +200,18 @@ Map _$TimeToJson(Time instance) => { 'time_zone': instance.timeZone, }; -TransitDetails _$TransitDetailsFromJson(Map json) { - return TransitDetails( - arrivalStop: Stop.fromJson(json['arrival_stop'] as Map), - departureStop: - Stop.fromJson(json['departure_stop'] as Map), - arrivalTime: Time.fromJson(json['arrival_time'] as Map), - departureTime: - Time.fromJson(json['departure_time'] as Map), - headsign: json['headsign'] as String, - headway: json['headway'] as num, - numStops: json['num_stops'] as num, - ); -} +TransitDetails _$TransitDetailsFromJson(Map json) => + TransitDetails( + arrivalStop: Stop.fromJson(json['arrival_stop'] as Map), + departureStop: + Stop.fromJson(json['departure_stop'] as Map), + arrivalTime: Time.fromJson(json['arrival_time'] as Map), + departureTime: + Time.fromJson(json['departure_time'] as Map), + headsign: json['headsign'] as String, + headway: json['headway'] as num, + numStops: json['num_stops'] as num, + ); Map _$TransitDetailsToJson(TransitDetails instance) => { @@ -269,32 +224,28 @@ Map _$TransitDetailsToJson(TransitDetails instance) => 'num_stops': instance.numStops, }; -Stop _$StopFromJson(Map json) { - return Stop( - name: json['name'] as String, - location: Location.fromJson(json['location'] as Map), - ); -} +Stop _$StopFromJson(Map json) => Stop( + name: json['name'] as String, + location: Location.fromJson(json['location'] as Map), + ); Map _$StopToJson(Stop instance) => { 'name': instance.name, 'location': instance.location, }; -Line _$LineFromJson(Map json) { - return Line( - name: json['name'] as String, - shortName: json['short_name'] as String, - color: json['color'] as String, - agencies: (json['agencies'] as List) - .map((e) => TransitAgency.fromJson(e as Map)) - .toList(), - url: json['url'] as String, - icon: json['icon'] as String, - textColor: json['text_color'] as String, - vehicle: VehicleType.fromJson(json['vehicle'] as Map), - ); -} +Line _$LineFromJson(Map json) => Line( + name: json['name'] as String, + shortName: json['short_name'] as String, + color: json['color'] as String, + agencies: (json['agencies'] as List) + .map((e) => TransitAgency.fromJson(e as Map)) + .toList(), + url: json['url'] as String, + icon: json['icon'] as String, + textColor: json['text_color'] as String, + vehicle: VehicleType.fromJson(json['vehicle'] as Map), + ); Map _$LineToJson(Line instance) => { 'name': instance.name, @@ -307,13 +258,12 @@ Map _$LineToJson(Line instance) => { 'vehicle': instance.vehicle, }; -TransitAgency _$TransitAgencyFromJson(Map json) { - return TransitAgency( - name: json['name'] as String, - url: json['url'] as String, - phone: json['phone'] as String, - ); -} +TransitAgency _$TransitAgencyFromJson(Map json) => + TransitAgency( + name: json['name'] as String, + url: json['url'] as String, + phone: json['phone'] as String, + ); Map _$TransitAgencyToJson(TransitAgency instance) => { @@ -322,14 +272,12 @@ Map _$TransitAgencyToJson(TransitAgency instance) => 'phone': instance.phone, }; -VehicleType _$VehicleTypeFromJson(Map json) { - return VehicleType( - name: json['name'] as String, - type: json['type'] as String, - icon: json['icon'] as String, - localIcon: json['local_icon'] as String, - ); -} +VehicleType _$VehicleTypeFromJson(Map json) => VehicleType( + name: json['name'] as String, + type: json['type'] as String, + icon: json['icon'] as String, + localIcon: json['local_icon'] as String, + ); Map _$VehicleTypeToJson(VehicleType instance) => { diff --git a/lib/src/distance.g.dart b/lib/src/distance.g.dart index a3685e4..bab9bdf 100644 --- a/lib/src/distance.g.dart +++ b/lib/src/distance.g.dart @@ -6,24 +6,23 @@ part of 'distance.dart'; // JsonSerializableGenerator // ************************************************************************** -DistanceResponse _$DistanceResponseFromJson(Map json) { - return DistanceResponse( - status: json['status'] as String, - errorMessage: json['error_message'] as String?, - originAddresses: (json['origin_addresses'] as List?) - ?.map((e) => e as String) - .toList() ?? - [], - destinationAddresses: (json['destination_addresses'] as List?) - ?.map((e) => e as String) - .toList() ?? - [], - rows: (json['rows'] as List?) - ?.map((e) => Row.fromJson(e as Map)) - .toList() ?? - [], - ); -} +DistanceResponse _$DistanceResponseFromJson(Map json) => + DistanceResponse( + status: json['status'] as String, + errorMessage: json['error_message'] as String?, + originAddresses: (json['origin_addresses'] as List?) + ?.map((e) => e as String) + .toList() ?? + [], + destinationAddresses: (json['destination_addresses'] as List?) + ?.map((e) => e as String) + .toList() ?? + [], + rows: (json['rows'] as List?) + ?.map((e) => Row.fromJson(e as Map)) + .toList() ?? + [], + ); Map _$DistanceResponseToJson(DistanceResponse instance) => { @@ -34,26 +33,22 @@ Map _$DistanceResponseToJson(DistanceResponse instance) => 'rows': instance.rows, }; -Row _$RowFromJson(Map json) { - return Row( - elements: (json['elements'] as List?) - ?.map((e) => Element.fromJson(e as Map)) - .toList() ?? - [], - ); -} +Row _$RowFromJson(Map json) => Row( + elements: (json['elements'] as List?) + ?.map((e) => Element.fromJson(e as Map)) + .toList() ?? + [], + ); Map _$RowToJson(Row instance) => { 'elements': instance.elements, }; -Element _$ElementFromJson(Map json) { - return Element( - distance: Value.fromJson(json['distance'] as Map), - duration: Value.fromJson(json['duration'] as Map), - elementStatus: json['element_status'] as String?, - ); -} +Element _$ElementFromJson(Map json) => Element( + distance: Value.fromJson(json['distance'] as Map), + duration: Value.fromJson(json['duration'] as Map), + elementStatus: json['element_status'] as String?, + ); Map _$ElementToJson(Element instance) => { 'distance': instance.distance, @@ -61,12 +56,10 @@ Map _$ElementToJson(Element instance) => { 'element_status': instance.elementStatus, }; -Value _$ValueFromJson(Map json) { - return Value( - value: json['value'] as num, - text: json['text'] as String, - ); -} +Value _$ValueFromJson(Map json) => Value( + value: json['value'] as num, + text: json['text'] as String, + ); Map _$ValueToJson(Value instance) => { 'value': instance.value, diff --git a/lib/src/geocoding.g.dart b/lib/src/geocoding.g.dart index 98ffee4..ab024e3 100644 --- a/lib/src/geocoding.g.dart +++ b/lib/src/geocoding.g.dart @@ -6,16 +6,15 @@ part of 'geocoding.dart'; // JsonSerializableGenerator // ************************************************************************** -GeocodingResponse _$GeocodingResponseFromJson(Map json) { - return GeocodingResponse( - status: json['status'] as String, - errorMessage: json['error_message'] as String?, - results: (json['results'] as List?) - ?.map((e) => GeocodingResult.fromJson(e as Map)) - .toList() ?? - [], - ); -} +GeocodingResponse _$GeocodingResponseFromJson(Map json) => + GeocodingResponse( + status: json['status'] as String, + errorMessage: json['error_message'] as String?, + results: (json['results'] as List?) + ?.map((e) => GeocodingResult.fromJson(e as Map)) + .toList() ?? + [], + ); Map _$GeocodingResponseToJson(GeocodingResponse instance) => { @@ -24,25 +23,24 @@ Map _$GeocodingResponseToJson(GeocodingResponse instance) => 'results': instance.results, }; -GeocodingResult _$GeocodingResultFromJson(Map json) { - return GeocodingResult( - geometry: Geometry.fromJson(json['geometry'] as Map), - placeId: json['place_id'] as String, - types: - (json['types'] as List?)?.map((e) => e as String).toList() ?? - [], - addressComponents: (json['address_components'] as List?) - ?.map((e) => AddressComponent.fromJson(e as Map)) - .toList() ?? - [], - postcodeLocalities: (json['postcode_localities'] as List?) - ?.map((e) => e as String) - .toList() ?? - [], - partialMatch: json['partial_match'] as bool? ?? false, - formattedAddress: json['formatted_address'] as String?, - ); -} +GeocodingResult _$GeocodingResultFromJson(Map json) => + GeocodingResult( + geometry: Geometry.fromJson(json['geometry'] as Map), + placeId: json['place_id'] as String, + types: + (json['types'] as List?)?.map((e) => e as String).toList() ?? + [], + addressComponents: (json['address_components'] as List?) + ?.map((e) => AddressComponent.fromJson(e as Map)) + .toList() ?? + [], + postcodeLocalities: (json['postcode_localities'] as List?) + ?.map((e) => e as String) + .toList() ?? + [], + partialMatch: json['partial_match'] as bool? ?? false, + formattedAddress: json['formatted_address'] as String?, + ); Map _$GeocodingResultToJson(GeocodingResult instance) => { @@ -55,24 +53,23 @@ Map _$GeocodingResultToJson(GeocodingResult instance) => 'place_id': instance.placeId, }; -StreetAddress _$StreetAddressFromJson(Map json) { - return StreetAddress( - geometry: json['geometry'] == null - ? null - : Geometry.fromJson(json['geometry'] as Map), - addressLine: json['address_line'] as String?, - countryName: json['country_name'] as String?, - countryCode: json['country_code'] as String?, - featureName: json['feature_name'] as String?, - postalCode: json['postal_code'] as String?, - adminArea: json['admin_area'] as String?, - subAdminArea: json['sub_admin_area'] as String?, - locality: json['locality'] as String?, - subLocality: json['sub_locality'] as String?, - thoroughfare: json['thoroughfare'] as String?, - subThoroughfare: json['sub_thoroughfare'] as String?, - ); -} +StreetAddress _$StreetAddressFromJson(Map json) => + StreetAddress( + geometry: json['geometry'] == null + ? null + : Geometry.fromJson(json['geometry'] as Map), + addressLine: json['address_line'] as String?, + countryName: json['country_name'] as String?, + countryCode: json['country_code'] as String?, + featureName: json['feature_name'] as String?, + postalCode: json['postal_code'] as String?, + adminArea: json['admin_area'] as String?, + subAdminArea: json['sub_admin_area'] as String?, + locality: json['locality'] as String?, + subLocality: json['sub_locality'] as String?, + thoroughfare: json['thoroughfare'] as String?, + subThoroughfare: json['sub_thoroughfare'] as String?, + ); Map _$StreetAddressToJson(StreetAddress instance) => { diff --git a/lib/src/geolocation.g.dart b/lib/src/geolocation.g.dart index 99a2820..750dc0f 100644 --- a/lib/src/geolocation.g.dart +++ b/lib/src/geolocation.g.dart @@ -6,13 +6,12 @@ part of 'geolocation.dart'; // JsonSerializableGenerator // ************************************************************************** -GeolocationError _$GeolocationErrorFromJson(Map json) { - return GeolocationError( - domain: json['domain'] as String, - reason: json['reason'] as String, - message: json['message'] as String, - ); -} +GeolocationError _$GeolocationErrorFromJson(Map json) => + GeolocationError( + domain: json['domain'] as String, + reason: json['reason'] as String, + message: json['message'] as String, + ); Map _$GeolocationErrorToJson(GeolocationError instance) => { @@ -22,16 +21,15 @@ Map _$GeolocationErrorToJson(GeolocationError instance) => }; GeolocationErrorResponse _$GeolocationErrorResponseFromJson( - Map json) { - return GeolocationErrorResponse( - errors: (json['errors'] as List?) - ?.map((e) => GeolocationError.fromJson(e as Map)) - .toList() ?? - [], - code: json['code'] as int, - message: json['message'] as String, - ); -} + Map json) => + GeolocationErrorResponse( + errors: (json['errors'] as List?) + ?.map((e) => GeolocationError.fromJson(e as Map)) + .toList() ?? + [], + code: json['code'] as int, + message: json['message'] as String, + ); Map _$GeolocationErrorResponseToJson( GeolocationErrorResponse instance) => @@ -41,18 +39,17 @@ Map _$GeolocationErrorResponseToJson( 'message': instance.message, }; -GeolocationResponse _$GeolocationResponseFromJson(Map json) { - return GeolocationResponse( - location: json['location'] == null - ? null - : Location.fromJson(json['location'] as Map), - accuracy: json['accuracy'] as num?, - error: json['error'] == null - ? null - : GeolocationErrorResponse.fromJson( - json['error'] as Map), - ); -} +GeolocationResponse _$GeolocationResponseFromJson(Map json) => + GeolocationResponse( + location: json['location'] == null + ? null + : Location.fromJson(json['location'] as Map), + accuracy: json['accuracy'] as num?, + error: json['error'] == null + ? null + : GeolocationErrorResponse.fromJson( + json['error'] as Map), + ); Map _$GeolocationResponseToJson( GeolocationResponse instance) => @@ -62,17 +59,15 @@ Map _$GeolocationResponseToJson( 'error': instance.error, }; -CellTower _$CellTowerFromJson(Map json) { - return CellTower( - cellId: json['cell_id'] as num, - locationAreaCode: json['location_area_code'] as num, - mobileCountryCode: json['mobile_country_code'] as num, - mobileNetworkCode: json['mobile_network_code'] as num, - timingAdvance: json['timing_advance'] as num?, - age: json['age'] as num?, - signalStrength: json['signal_strength'] as num?, - ); -} +CellTower _$CellTowerFromJson(Map json) => CellTower( + cellId: json['cell_id'] as num, + locationAreaCode: json['location_area_code'] as num, + mobileCountryCode: json['mobile_country_code'] as num, + mobileNetworkCode: json['mobile_network_code'] as num, + timingAdvance: json['timing_advance'] as num?, + age: json['age'] as num?, + signalStrength: json['signal_strength'] as num?, + ); Map _$CellTowerToJson(CellTower instance) => { 'age': instance.age, @@ -84,15 +79,14 @@ Map _$CellTowerToJson(CellTower instance) => { 'timing_advance': instance.timingAdvance, }; -WifiAccessPoint _$WifiAccessPointFromJson(Map json) { - return WifiAccessPoint( - age: json['age'] as num?, - signalStrength: json['signal_strength'] as num?, - macAddress: json['mac_address'] as String?, - channel: json['channel'], - signalToNoiseRatio: json['signal_to_noise_ratio'] as num?, - ); -} +WifiAccessPoint _$WifiAccessPointFromJson(Map json) => + WifiAccessPoint( + age: json['age'] as num?, + signalStrength: json['signal_strength'] as num?, + macAddress: json['mac_address'] as String?, + channel: json['channel'], + signalToNoiseRatio: json['signal_to_noise_ratio'] as num?, + ); Map _$WifiAccessPointToJson(WifiAccessPoint instance) => { diff --git a/lib/src/places.dart b/lib/src/places.dart index 7eb8933..9485141 100644 --- a/lib/src/places.dart +++ b/lib/src/places.dart @@ -681,6 +681,44 @@ class PlaceDetails { final Geometry? geometry; + final PlusCode? plusCode; + + final bool? reservable; + + final bool? servesBeer; + + final bool? servesBreakfast; + + final bool? servesBrunch; + + final bool? servesDinner; + + final bool? servesLunch; + + final bool? servesVegetarianFood; + + final bool? servesWine; + + final bool? takeout; + + final int? userRatingsTotal; + + final bool? wheelChairAccessibleEntrance; + + final String? businessStatus; + + final bool? curbsidePickup; + + final bool? delivery; + + final bool? dineIn; + + final PlaceEditorialSummary? editorialSummary; + + final String? iconBackgroundColor; + + final String? iconMaskBaseUri; + PlaceDetails({ this.adrAddress, required this.name, @@ -704,6 +742,25 @@ class PlaceDetails { this.vicinity, this.website, this.geometry, + this.businessStatus, + this.curbsidePickup, + this.delivery, + this.dineIn, + this.editorialSummary, + this.iconBackgroundColor, + this.iconMaskBaseUri, + this.plusCode, + this.reservable, + this.servesBeer, + this.servesBreakfast, + this.servesBrunch, + this.servesDinner, + this.servesLunch, + this.servesVegetarianFood, + this.servesWine, + this.takeout, + this.userRatingsTotal, + this.wheelChairAccessibleEntrance, }); factory PlaceDetails.fromJson(Map json) => @@ -733,6 +790,36 @@ class OpeningHoursDetail { Map toJson() => _$OpeningHoursDetailToJson(this); } +@JsonSerializable() +class PlaceEditorialSummary { + final String? language; + final String? overview; + + PlaceEditorialSummary({ + this.language, + this.overview, + }); + + factory PlaceEditorialSummary.fromJson(Map json) => + _$PlaceEditorialSummaryFromJson(json); + Map toJson() => _$PlaceEditorialSummaryToJson(this); +} + +@JsonSerializable() +class PlusCode { + final String globalCode; + final String? compoundCode; + + PlusCode({ + required this.globalCode, + this.compoundCode, + }); + + factory PlusCode.fromJson(Map json) => + _$PlusCodeFromJson(json); + Map toJson() => _$PlusCodeToJson(this); +} + @JsonSerializable() class OpeningHoursPeriodDate { final int day; diff --git a/lib/src/places.g.dart b/lib/src/places.g.dart index b7a3fd7..7b61fbd 100644 --- a/lib/src/places.g.dart +++ b/lib/src/places.g.dart @@ -6,21 +6,22 @@ part of 'places.dart'; // JsonSerializableGenerator // ************************************************************************** -PlacesSearchResponse _$PlacesSearchResponseFromJson(Map json) { - return PlacesSearchResponse( - status: json['status'] as String, - errorMessage: json['error_message'] as String?, - results: (json['results'] as List?) - ?.map((e) => PlacesSearchResult.fromJson(e as Map)) - .toList() ?? - [], - htmlAttributions: (json['html_attributions'] as List?) - ?.map((e) => e as String) - .toList() ?? - [], - nextPageToken: json['next_page_token'] as String?, - ); -} +PlacesSearchResponse _$PlacesSearchResponseFromJson( + Map json) => + PlacesSearchResponse( + status: json['status'] as String, + errorMessage: json['error_message'] as String?, + results: (json['results'] as List?) + ?.map( + (e) => PlacesSearchResult.fromJson(e as Map)) + .toList() ?? + [], + htmlAttributions: (json['html_attributions'] as List?) + ?.map((e) => e as String) + .toList() ?? + [], + nextPageToken: json['next_page_token'] as String?, + ); Map _$PlacesSearchResponseToJson( PlacesSearchResponse instance) => @@ -32,39 +33,38 @@ Map _$PlacesSearchResponseToJson( 'next_page_token': instance.nextPageToken, }; -PlacesSearchResult _$PlacesSearchResultFromJson(Map json) { - return PlacesSearchResult( - id: json['id'] as String?, - reference: json['reference'] as String, - name: json['name'] as String, - placeId: json['place_id'] as String, - formattedAddress: json['formatted_address'] as String?, - photos: (json['photos'] as List?) - ?.map((e) => Photo.fromJson(e as Map)) - .toList() ?? - [], - altIds: (json['alt_ids'] as List?) - ?.map((e) => AlternativeId.fromJson(e as Map)) - .toList() ?? - [], - types: - (json['types'] as List?)?.map((e) => e as String).toList() ?? - [], - permanentlyClosed: json['permanently_closed'] as bool? ?? false, - icon: json['icon'] as String?, - geometry: json['geometry'] == null - ? null - : Geometry.fromJson(json['geometry'] as Map), - openingHours: json['opening_hours'] == null - ? null - : OpeningHoursDetail.fromJson( - json['opening_hours'] as Map), - scope: json['scope'] as String?, - priceLevel: _$enumDecodeNullable(_$PriceLevelEnumMap, json['price_level']), - rating: json['rating'] as num?, - vicinity: json['vicinity'] as String?, - ); -} +PlacesSearchResult _$PlacesSearchResultFromJson(Map json) => + PlacesSearchResult( + id: json['id'] as String?, + reference: json['reference'] as String, + name: json['name'] as String, + placeId: json['place_id'] as String, + formattedAddress: json['formatted_address'] as String?, + photos: (json['photos'] as List?) + ?.map((e) => Photo.fromJson(e as Map)) + .toList() ?? + [], + altIds: (json['alt_ids'] as List?) + ?.map((e) => AlternativeId.fromJson(e as Map)) + .toList() ?? + [], + types: + (json['types'] as List?)?.map((e) => e as String).toList() ?? + [], + permanentlyClosed: json['permanently_closed'] as bool? ?? false, + icon: json['icon'] as String?, + geometry: json['geometry'] == null + ? null + : Geometry.fromJson(json['geometry'] as Map), + openingHours: json['opening_hours'] == null + ? null + : OpeningHoursDetail.fromJson( + json['opening_hours'] as Map), + scope: json['scope'] as String?, + priceLevel: $enumDecodeNullable(_$PriceLevelEnumMap, json['price_level']), + rating: json['rating'] as num?, + vicinity: json['vicinity'] as String?, + ); Map _$PlacesSearchResultToJson(PlacesSearchResult instance) => { @@ -86,43 +86,6 @@ Map _$PlacesSearchResultToJson(PlacesSearchResult instance) => 'reference': instance.reference, }; -K _$enumDecode( - Map enumValues, - Object? source, { - K? unknownValue, -}) { - if (source == null) { - throw ArgumentError( - 'A value must be provided. Supported values: ' - '${enumValues.values.join(', ')}', - ); - } - - return enumValues.entries.singleWhere( - (e) => e.value == source, - orElse: () { - if (unknownValue == null) { - throw ArgumentError( - '`$source` is not one of the supported values: ' - '${enumValues.values.join(', ')}', - ); - } - return MapEntry(unknownValue, enumValues.values.first); - }, - ).key; -} - -K? _$enumDecodeNullable( - Map enumValues, - dynamic source, { - K? unknownValue, -}) { - if (source == null) { - return null; - } - return _$enumDecode(enumValues, source, unknownValue: unknownValue); -} - const _$PriceLevelEnumMap = { PriceLevel.free: 0, PriceLevel.inexpensive: 1, @@ -131,48 +94,71 @@ const _$PriceLevelEnumMap = { PriceLevel.veryExpensive: 4, }; -PlaceDetails _$PlaceDetailsFromJson(Map json) { - return PlaceDetails( - adrAddress: json['adr_address'] as String?, - name: json['name'] as String, - placeId: json['place_id'] as String, - utcOffset: json['utc_offset'] as num?, - id: json['id'] as String?, - internationalPhoneNumber: json['international_phone_number'] as String?, - addressComponents: (json['address_components'] as List?) - ?.map((e) => AddressComponent.fromJson(e as Map)) - .toList() ?? - [], - photos: (json['photos'] as List?) - ?.map((e) => Photo.fromJson(e as Map)) - .toList() ?? - [], - types: - (json['types'] as List?)?.map((e) => e as String).toList() ?? - [], - reviews: (json['reviews'] as List?) - ?.map((e) => Review.fromJson(e as Map)) - .toList() ?? - [], - formattedAddress: json['formatted_address'] as String?, - formattedPhoneNumber: json['formatted_phone_number'] as String?, - reference: json['reference'] as String?, - icon: json['icon'] as String?, - rating: json['rating'] as num?, - openingHours: json['opening_hours'] == null - ? null - : OpeningHoursDetail.fromJson( - json['opening_hours'] as Map), - priceLevel: _$enumDecodeNullable(_$PriceLevelEnumMap, json['price_level']), - scope: json['scope'] as String?, - url: json['url'] as String?, - vicinity: json['vicinity'] as String?, - website: json['website'] as String?, - geometry: json['geometry'] == null - ? null - : Geometry.fromJson(json['geometry'] as Map), - ); -} +PlaceDetails _$PlaceDetailsFromJson(Map json) => PlaceDetails( + adrAddress: json['adr_address'] as String?, + name: json['name'] as String, + placeId: json['place_id'] as String, + utcOffset: json['utc_offset'] as num?, + id: json['id'] as String?, + internationalPhoneNumber: json['international_phone_number'] as String?, + addressComponents: (json['address_components'] as List?) + ?.map((e) => AddressComponent.fromJson(e as Map)) + .toList() ?? + [], + photos: (json['photos'] as List?) + ?.map((e) => Photo.fromJson(e as Map)) + .toList() ?? + [], + types: + (json['types'] as List?)?.map((e) => e as String).toList() ?? + [], + reviews: (json['reviews'] as List?) + ?.map((e) => Review.fromJson(e as Map)) + .toList() ?? + [], + formattedAddress: json['formatted_address'] as String?, + formattedPhoneNumber: json['formatted_phone_number'] as String?, + reference: json['reference'] as String?, + icon: json['icon'] as String?, + rating: json['rating'] as num?, + openingHours: json['opening_hours'] == null + ? null + : OpeningHoursDetail.fromJson( + json['opening_hours'] as Map), + priceLevel: $enumDecodeNullable(_$PriceLevelEnumMap, json['price_level']), + scope: json['scope'] as String?, + url: json['url'] as String?, + vicinity: json['vicinity'] as String?, + website: json['website'] as String?, + geometry: json['geometry'] == null + ? null + : Geometry.fromJson(json['geometry'] as Map), + businessStatus: json['business_status'] as String?, + curbsidePickup: json['curbside_pickup'] as bool?, + delivery: json['delivery'] as bool?, + dineIn: json['dine_in'] as bool?, + editorialSummary: json['editorial_summary'] == null + ? null + : PlaceEditorialSummary.fromJson( + json['editorial_summary'] as Map), + iconBackgroundColor: json['icon_background_color'] as String?, + iconMaskBaseUri: json['icon_mask_base_uri'] as String?, + plusCode: json['plus_code'] == null + ? null + : PlusCode.fromJson(json['plus_code'] as Map), + reservable: json['reservable'] as bool?, + servesBeer: json['serves_beer'] as bool?, + servesBreakfast: json['serves_breakfast'] as bool?, + servesBrunch: json['serves_brunch'] as bool?, + servesDinner: json['serves_dinner'] as bool?, + servesLunch: json['serves_lunch'] as bool?, + servesVegetarianFood: json['serves_vegetarian_food'] as bool?, + servesWine: json['serves_wine'] as bool?, + takeout: json['takeout'] as bool?, + userRatingsTotal: json['user_ratings_total'] as int?, + wheelChairAccessibleEntrance: + json['wheel_chair_accessible_entrance'] as bool?, + ); Map _$PlaceDetailsToJson(PlaceDetails instance) => { @@ -198,21 +184,40 @@ Map _$PlaceDetailsToJson(PlaceDetails instance) => 'website': instance.website, 'reviews': instance.reviews, 'geometry': instance.geometry, + 'plus_code': instance.plusCode, + 'reservable': instance.reservable, + 'serves_beer': instance.servesBeer, + 'serves_breakfast': instance.servesBreakfast, + 'serves_brunch': instance.servesBrunch, + 'serves_dinner': instance.servesDinner, + 'serves_lunch': instance.servesLunch, + 'serves_vegetarian_food': instance.servesVegetarianFood, + 'serves_wine': instance.servesWine, + 'takeout': instance.takeout, + 'user_ratings_total': instance.userRatingsTotal, + 'wheel_chair_accessible_entrance': instance.wheelChairAccessibleEntrance, + 'business_status': instance.businessStatus, + 'curbside_pickup': instance.curbsidePickup, + 'delivery': instance.delivery, + 'dine_in': instance.dineIn, + 'editorial_summary': instance.editorialSummary, + 'icon_background_color': instance.iconBackgroundColor, + 'icon_mask_base_uri': instance.iconMaskBaseUri, }; -OpeningHoursDetail _$OpeningHoursDetailFromJson(Map json) { - return OpeningHoursDetail( - openNow: json['open_now'] as bool? ?? false, - periods: (json['periods'] as List?) - ?.map((e) => OpeningHoursPeriod.fromJson(e as Map)) - .toList() ?? - [], - weekdayText: (json['weekday_text'] as List?) - ?.map((e) => e as String) - .toList() ?? - [], - ); -} +OpeningHoursDetail _$OpeningHoursDetailFromJson(Map json) => + OpeningHoursDetail( + openNow: json['open_now'] as bool? ?? false, + periods: (json['periods'] as List?) + ?.map( + (e) => OpeningHoursPeriod.fromJson(e as Map)) + .toList() ?? + [], + weekdayText: (json['weekday_text'] as List?) + ?.map((e) => e as String) + .toList() ?? + [], + ); Map _$OpeningHoursDetailToJson(OpeningHoursDetail instance) => { @@ -221,13 +226,36 @@ Map _$OpeningHoursDetailToJson(OpeningHoursDetail instance) => 'weekday_text': instance.weekdayText, }; +PlaceEditorialSummary _$PlaceEditorialSummaryFromJson( + Map json) => + PlaceEditorialSummary( + language: json['language'] as String?, + overview: json['overview'] as String?, + ); + +Map _$PlaceEditorialSummaryToJson( + PlaceEditorialSummary instance) => + { + 'language': instance.language, + 'overview': instance.overview, + }; + +PlusCode _$PlusCodeFromJson(Map json) => PlusCode( + globalCode: json['global_code'] as String, + compoundCode: json['compound_code'] as String?, + ); + +Map _$PlusCodeToJson(PlusCode instance) => { + 'global_code': instance.globalCode, + 'compound_code': instance.compoundCode, + }; + OpeningHoursPeriodDate _$OpeningHoursPeriodDateFromJson( - Map json) { - return OpeningHoursPeriodDate( - day: json['day'] as int, - time: json['time'] as String, - ); -} + Map json) => + OpeningHoursPeriodDate( + day: json['day'] as int, + time: json['time'] as String, + ); Map _$OpeningHoursPeriodDateToJson( OpeningHoursPeriodDate instance) => @@ -236,17 +264,17 @@ Map _$OpeningHoursPeriodDateToJson( 'time': instance.time, }; -OpeningHoursPeriod _$OpeningHoursPeriodFromJson(Map json) { - return OpeningHoursPeriod( - open: json['open'] == null - ? null - : OpeningHoursPeriodDate.fromJson(json['open'] as Map), - close: json['close'] == null - ? null - : OpeningHoursPeriodDate.fromJson( - json['close'] as Map), - ); -} +OpeningHoursPeriod _$OpeningHoursPeriodFromJson(Map json) => + OpeningHoursPeriod( + open: json['open'] == null + ? null + : OpeningHoursPeriodDate.fromJson( + json['open'] as Map), + close: json['close'] == null + ? null + : OpeningHoursPeriodDate.fromJson( + json['close'] as Map), + ); Map _$OpeningHoursPeriodToJson(OpeningHoursPeriod instance) => { @@ -254,17 +282,15 @@ Map _$OpeningHoursPeriodToJson(OpeningHoursPeriod instance) => 'close': instance.close, }; -Photo _$PhotoFromJson(Map json) { - return Photo( - photoReference: json['photo_reference'] as String, - height: json['height'] as num, - width: json['width'] as num, - htmlAttributions: (json['html_attributions'] as List?) - ?.map((e) => e as String) - .toList() ?? - [], - ); -} +Photo _$PhotoFromJson(Map json) => Photo( + photoReference: json['photo_reference'] as String, + height: json['height'] as num, + width: json['width'] as num, + htmlAttributions: (json['html_attributions'] as List?) + ?.map((e) => e as String) + .toList() ?? + [], + ); Map _$PhotoToJson(Photo instance) => { 'photo_reference': instance.photoReference, @@ -273,12 +299,11 @@ Map _$PhotoToJson(Photo instance) => { 'html_attributions': instance.htmlAttributions, }; -AlternativeId _$AlternativeIdFromJson(Map json) { - return AlternativeId( - placeId: json['place_id'] as String, - scope: json['scope'] as String, - ); -} +AlternativeId _$AlternativeIdFromJson(Map json) => + AlternativeId( + placeId: json['place_id'] as String, + scope: json['scope'] as String, + ); Map _$AlternativeIdToJson(AlternativeId instance) => { @@ -287,17 +312,16 @@ Map _$AlternativeIdToJson(AlternativeId instance) => }; PlacesDetailsResponse _$PlacesDetailsResponseFromJson( - Map json) { - return PlacesDetailsResponse( - status: json['status'] as String, - errorMessage: json['error_message'] as String?, - result: PlaceDetails.fromJson(json['result'] as Map), - htmlAttributions: (json['html_attributions'] as List?) - ?.map((e) => e as String) - .toList() ?? - [], - ); -} + Map json) => + PlacesDetailsResponse( + status: json['status'] as String, + errorMessage: json['error_message'] as String?, + result: PlaceDetails.fromJson(json['result'] as Map), + htmlAttributions: (json['html_attributions'] as List?) + ?.map((e) => e as String) + .toList() ?? + [], + ); Map _$PlacesDetailsResponseToJson( PlacesDetailsResponse instance) => @@ -308,18 +332,16 @@ Map _$PlacesDetailsResponseToJson( 'html_attributions': instance.htmlAttributions, }; -Review _$ReviewFromJson(Map json) { - return Review( - authorName: json['author_name'] as String, - authorUrl: json['author_url'] as String, - language: json['language'] as String?, - profilePhotoUrl: json['profile_photo_url'] as String, - rating: json['rating'] as num, - relativeTimeDescription: json['relative_time_description'] as String, - text: json['text'] as String, - time: json['time'] as num, - ); -} +Review _$ReviewFromJson(Map json) => Review( + authorName: json['author_name'] as String, + authorUrl: json['author_url'] as String, + language: json['language'] as String?, + profilePhotoUrl: json['profile_photo_url'] as String, + rating: json['rating'] as num, + relativeTimeDescription: json['relative_time_description'] as String, + text: json['text'] as String, + time: json['time'] as num, + ); Map _$ReviewToJson(Review instance) => { 'author_name': instance.authorName, @@ -333,16 +355,15 @@ Map _$ReviewToJson(Review instance) => { }; PlacesAutocompleteResponse _$PlacesAutocompleteResponseFromJson( - Map json) { - return PlacesAutocompleteResponse( - status: json['status'] as String, - errorMessage: json['error_message'] as String?, - predictions: (json['predictions'] as List?) - ?.map((e) => Prediction.fromJson(e as Map)) - .toList() ?? - [], - ); -} + Map json) => + PlacesAutocompleteResponse( + status: json['status'] as String, + errorMessage: json['error_message'] as String?, + predictions: (json['predictions'] as List?) + ?.map((e) => Prediction.fromJson(e as Map)) + .toList() ?? + [], + ); Map _$PlacesAutocompleteResponseToJson( PlacesAutocompleteResponse instance) => @@ -352,30 +373,28 @@ Map _$PlacesAutocompleteResponseToJson( 'predictions': instance.predictions, }; -Prediction _$PredictionFromJson(Map json) { - return Prediction( - description: json['description'] as String?, - id: json['id'] as String?, - terms: (json['terms'] as List?) - ?.map((e) => Term.fromJson(e as Map)) - .toList() ?? - [], - distanceMeters: json['distance_meters'] as int?, - placeId: json['place_id'] as String?, - reference: json['reference'] as String?, - types: - (json['types'] as List?)?.map((e) => e as String).toList() ?? - [], - matchedSubstrings: (json['matched_substrings'] as List?) - ?.map((e) => MatchedSubstring.fromJson(e as Map)) - .toList() ?? - [], - structuredFormatting: json['structured_formatting'] == null - ? null - : StructuredFormatting.fromJson( - json['structured_formatting'] as Map), - ); -} +Prediction _$PredictionFromJson(Map json) => Prediction( + description: json['description'] as String?, + id: json['id'] as String?, + terms: (json['terms'] as List?) + ?.map((e) => Term.fromJson(e as Map)) + .toList() ?? + [], + distanceMeters: json['distance_meters'] as int?, + placeId: json['place_id'] as String?, + reference: json['reference'] as String?, + types: + (json['types'] as List?)?.map((e) => e as String).toList() ?? + [], + matchedSubstrings: (json['matched_substrings'] as List?) + ?.map((e) => MatchedSubstring.fromJson(e as Map)) + .toList() ?? + [], + structuredFormatting: json['structured_formatting'] == null + ? null + : StructuredFormatting.fromJson( + json['structured_formatting'] as Map), + ); Map _$PredictionToJson(Prediction instance) => { @@ -390,24 +409,21 @@ Map _$PredictionToJson(Prediction instance) => 'structured_formatting': instance.structuredFormatting, }; -Term _$TermFromJson(Map json) { - return Term( - offset: json['offset'] as num, - value: json['value'] as String, - ); -} +Term _$TermFromJson(Map json) => Term( + offset: json['offset'] as num, + value: json['value'] as String, + ); Map _$TermToJson(Term instance) => { 'offset': instance.offset, 'value': instance.value, }; -MatchedSubstring _$MatchedSubstringFromJson(Map json) { - return MatchedSubstring( - offset: json['offset'] as num, - length: json['length'] as num, - ); -} +MatchedSubstring _$MatchedSubstringFromJson(Map json) => + MatchedSubstring( + offset: json['offset'] as num, + length: json['length'] as num, + ); Map _$MatchedSubstringToJson(MatchedSubstring instance) => { @@ -415,17 +431,17 @@ Map _$MatchedSubstringToJson(MatchedSubstring instance) => 'length': instance.length, }; -StructuredFormatting _$StructuredFormattingFromJson(Map json) { - return StructuredFormatting( - mainText: json['main_text'] as String, - mainTextMatchedSubstrings: (json['main_text_matched_substrings'] - as List?) - ?.map((e) => MatchedSubstring.fromJson(e as Map)) - .toList() ?? - [], - secondaryText: json['secondary_text'] as String?, - ); -} +StructuredFormatting _$StructuredFormattingFromJson( + Map json) => + StructuredFormatting( + mainText: json['main_text'] as String, + mainTextMatchedSubstrings: (json['main_text_matched_substrings'] + as List?) + ?.map((e) => MatchedSubstring.fromJson(e as Map)) + .toList() ?? + [], + secondaryText: json['secondary_text'] as String?, + ); Map _$StructuredFormattingToJson( StructuredFormatting instance) => diff --git a/lib/src/timezone.g.dart b/lib/src/timezone.g.dart index e29c164..c7a01ac 100644 --- a/lib/src/timezone.g.dart +++ b/lib/src/timezone.g.dart @@ -6,21 +6,20 @@ part of 'timezone.dart'; // JsonSerializableGenerator // ************************************************************************** -TimezoneResponse _$TimezoneResponseFromJson(Map json) { - return TimezoneResponse( - status: json['status'] as String, - errorMessage: json['error_message'] as String?, - dstOffset: json['dstOffset'] as int, - rawOffset: json['rawOffset'] as int, - timeZoneId: json['timeZoneId'] as String, - timeZoneName: json['timeZoneName'] as String, - ); -} +TimezoneResponse _$TimezoneResponseFromJson(Map json) => + TimezoneResponse( + status: json['status'] as String, + errorMessage: json['errorMessage'] as String?, + dstOffset: json['dstOffset'] as int, + rawOffset: json['rawOffset'] as int, + timeZoneId: json['timeZoneId'] as String, + timeZoneName: json['timeZoneName'] as String, + ); Map _$TimezoneResponseToJson(TimezoneResponse instance) => { 'status': instance.status, - 'error_message': instance.errorMessage, + 'errorMessage': instance.errorMessage, 'dstOffset': instance.dstOffset, 'rawOffset': instance.rawOffset, 'timeZoneId': instance.timeZoneId,