Skip to content

Commit

Permalink
2.0.0-beta.1
Browse files Browse the repository at this point in the history
  • Loading branch information
hoc081098 committed Sep 30, 2023
1 parent 6b88f3e commit 5920200
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 51 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# flutter_google_places_hoc081098 changelog

## 2.0.0-beta.1 - Sep 30, 2023

- Chore: update generated files.

## 2.0.0-beta.0 - Jun 27, 2023

- Requires `Dart 3.0` or later.
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ packages:
path: ".."
relative: true
source: path
version: "2.0.0-beta.0"
version: "2.0.0-beta.1"
flutter_lints:
dependency: "direct dev"
description:
Expand Down
27 changes: 17 additions & 10 deletions lib/src/google_maps_webservice/src/core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ import 'package:meta/meta.dart';

part 'core.g.dart';

@JsonSerializable(fieldRename: FieldRename.snake)
const _jsonSerializable = JsonSerializable(
fieldRename: FieldRename.snake,
explicitToJson: true,
);

@_jsonSerializable
@immutable
class Location {
final double lat;
Expand All @@ -22,7 +27,7 @@ class Location {
String toString() => '$lat,$lng';
}

@JsonSerializable(fieldRename: FieldRename.snake)
@_jsonSerializable
@immutable
class Geometry {
final Location location;
Expand All @@ -46,7 +51,7 @@ class Geometry {
Map<String, dynamic> toJson() => _$GeometryToJson(this);
}

@JsonSerializable(fieldRename: FieldRename.snake)
@_jsonSerializable
@immutable
class Bounds {
final Location northeast;
Expand Down Expand Up @@ -108,7 +113,7 @@ abstract class GoogleResponse<T> extends GoogleResponseStatus {
: super(status: status, errorMessage: errorMessage);
}

@JsonSerializable(fieldRename: FieldRename.snake)
@_jsonSerializable
@immutable
class AddressComponent {
@JsonKey(defaultValue: <Never>[])
Expand Down Expand Up @@ -159,7 +164,7 @@ enum TravelMode {
transit,
}

@JsonSerializable(fieldRename: FieldRename.snake)
@_jsonSerializable
@immutable
class _TravelMode {
final TravelMode value;
Expand All @@ -169,6 +174,7 @@ class _TravelMode {
// ignore: unused_element
factory _TravelMode.fromJson(Map<String, dynamic> json) =>
_$TravelModeFromJson(json);

Map<String, dynamic> toJson() => _$TravelModeToJson(this);
}

Expand All @@ -189,7 +195,7 @@ enum RouteType {
indoor,
}

@JsonSerializable(fieldRename: FieldRename.snake)
@_jsonSerializable
@immutable
class _RouteType {
final RouteType value;
Expand Down Expand Up @@ -217,7 +223,7 @@ enum Unit {
imperial,
}

@JsonSerializable(fieldRename: FieldRename.snake)
@_jsonSerializable
@immutable
class _Unit {
final Unit value;
Expand Down Expand Up @@ -246,7 +252,7 @@ enum TrafficModel {
optimistic,
}

@JsonSerializable(fieldRename: FieldRename.snake)
@_jsonSerializable
@immutable
class _TrafficModel {
final TrafficModel value;
Expand Down Expand Up @@ -277,7 +283,7 @@ enum TransitMode {
rail,
}

@JsonSerializable(fieldRename: FieldRename.snake)
@_jsonSerializable
@immutable
class _TransitMode {
final TransitMode value;
Expand Down Expand Up @@ -307,7 +313,7 @@ enum TransitRoutingPreferences {
fewerTransfers,
}

@JsonSerializable(fieldRename: FieldRename.snake)
@_jsonSerializable
@immutable
class _TransitRoutingPreferences {
final TransitRoutingPreferences value;
Expand All @@ -317,6 +323,7 @@ class _TransitRoutingPreferences {
// ignore: unused_element
factory _TransitRoutingPreferences.fromJson(Map<String, dynamic> json) =>
_$TransitRoutingPreferencesFromJson(json);

Map<String, dynamic> toJson() => _$TransitRoutingPreferencesToJson(this);
}

Expand Down
10 changes: 5 additions & 5 deletions lib/src/google_maps_webservice/src/core.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 20 additions & 15 deletions lib/src/google_maps_webservice/src/places.dart
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,12 @@ class GoogleMapsPlaces extends GoogleWebService {
json.decode(res.body) as Map<String, dynamic>);
}

@JsonSerializable(fieldRename: FieldRename.snake)
const _jsonSerializable = JsonSerializable(
fieldRename: FieldRename.snake,
explicitToJson: true,
);

@_jsonSerializable
@immutable
class PlacesSearchResponse extends GoogleResponseStatus {
@JsonKey(defaultValue: <Never>[])
Expand All @@ -545,7 +550,7 @@ class PlacesSearchResponse extends GoogleResponseStatus {
Map<String, dynamic> toJson() => _$PlacesSearchResponseToJson(this);
}

@JsonSerializable(fieldRename: FieldRename.snake)
@_jsonSerializable
@immutable
class PlacesSearchResult {
final String? icon;
Expand Down Expand Up @@ -612,7 +617,7 @@ class PlacesSearchResult {
Map<String, dynamic> toJson() => _$PlacesSearchResultToJson(this);
}

@JsonSerializable(fieldRename: FieldRename.snake)
@_jsonSerializable
@immutable
class PlaceDetails {
/// JSON address_components
Expand Down Expand Up @@ -702,7 +707,7 @@ class PlaceDetails {
Map<String, dynamic> toJson() => _$PlaceDetailsToJson(this);
}

@JsonSerializable(fieldRename: FieldRename.snake)
@_jsonSerializable
@immutable
class OpeningHoursDetail {
@JsonKey(defaultValue: false)
Expand All @@ -725,7 +730,7 @@ class OpeningHoursDetail {
Map<String, dynamic> toJson() => _$OpeningHoursDetailToJson(this);
}

@JsonSerializable(fieldRename: FieldRename.snake)
@_jsonSerializable
@immutable
class OpeningHoursPeriodDate {
final int day;
Expand All @@ -744,7 +749,7 @@ class OpeningHoursPeriodDate {
Map<String, dynamic> toJson() => _$OpeningHoursPeriodDateToJson(this);
}

@JsonSerializable(fieldRename: FieldRename.snake)
@_jsonSerializable
@immutable
class OpeningHoursPeriod {
final OpeningHoursPeriodDate? open;
Expand All @@ -757,7 +762,7 @@ class OpeningHoursPeriod {
Map<String, dynamic> toJson() => _$OpeningHoursPeriodToJson(this);
}

@JsonSerializable(fieldRename: FieldRename.snake)
@_jsonSerializable
@immutable
class Photo {
/// JSON photo_reference
Expand All @@ -780,7 +785,7 @@ class Photo {
Map<String, dynamic> toJson() => _$PhotoToJson(this);
}

@JsonSerializable(fieldRename: FieldRename.snake)
@_jsonSerializable
@immutable
class AlternativeId {
/// JSON place_id
Expand Down Expand Up @@ -812,7 +817,7 @@ enum PriceLevel {
veryExpensive,
}

@JsonSerializable(fieldRename: FieldRename.snake)
@_jsonSerializable
@immutable
class PlacesDetailsResponse extends GoogleResponseStatus {
final PlaceDetails result;
Expand All @@ -836,7 +841,7 @@ class PlacesDetailsResponse extends GoogleResponseStatus {
Map<String, dynamic> toJson() => _$PlacesDetailsResponseToJson(this);
}

@JsonSerializable(fieldRename: FieldRename.snake)
@_jsonSerializable
@immutable
class Review {
/// JSON author_name
Expand Down Expand Up @@ -874,7 +879,7 @@ class Review {
Map<String, dynamic> toJson() => _$ReviewToJson(this);
}

@JsonSerializable(fieldRename: FieldRename.snake)
@_jsonSerializable
@immutable
class PlacesAutocompleteResponse extends GoogleResponseStatus {
@JsonKey(defaultValue: <Prediction>[])
Expand All @@ -894,7 +899,7 @@ class PlacesAutocompleteResponse extends GoogleResponseStatus {
Map<String, dynamic> toJson() => _$PlacesAutocompleteResponseToJson(this);
}

@JsonSerializable(fieldRename: FieldRename.snake)
@_jsonSerializable
@immutable
class Prediction {
final String? description;
Expand Down Expand Up @@ -935,7 +940,7 @@ class Prediction {
Map<String, dynamic> toJson() => _$PredictionToJson(this);
}

@JsonSerializable(fieldRename: FieldRename.snake)
@_jsonSerializable
@immutable
class Term {
final num offset;
Expand All @@ -961,7 +966,7 @@ class Term {
int get hashCode => offset.hashCode ^ value.hashCode;
}

@JsonSerializable(fieldRename: FieldRename.snake)
@_jsonSerializable
@immutable
class MatchedSubstring {
final num offset;
Expand All @@ -988,7 +993,7 @@ class MatchedSubstring {
int get hashCode => offset.hashCode ^ length.hashCode;
}

@JsonSerializable(fieldRename: FieldRename.snake)
@_jsonSerializable
@immutable
class StructuredFormatting {
final String mainText;
Expand Down
Loading

0 comments on commit 5920200

Please sign in to comment.