From e50ceea009e584bd5b419e2eb33a3c407e7a1446 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klemen=20Tu=C5=A1ar?= Date: Sun, 9 Jun 2024 12:37:45 +0100 Subject: [PATCH] chore: rename lat / lng to latitude / longitude --- examples/alice_chopper/lib/main.dart | 20 +++++++++---------- .../lib/models/geo_location.dart | 20 ++++++++++--------- .../lib/models/geo_location.g.dart | 8 ++++---- 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/examples/alice_chopper/lib/main.dart b/examples/alice_chopper/lib/main.dart index 9c04403d..71b53a73 100644 --- a/examples/alice_chopper/lib/main.dart +++ b/examples/alice_chopper/lib/main.dart @@ -308,8 +308,8 @@ class _MyAppState extends State { city: 'Springfield', zipCode: '12345-6789', geoLocation: GeoLocation( - lat: 37.1234, - lng: -122.1234, + latitude: 37.1234, + longitude: -122.1234, ), ), company: Company( @@ -337,8 +337,8 @@ class _MyAppState extends State { city: 'New York', street: '1234 Main St', geoLocation: johnDoe.address.geoLocation.copyWith( - lat: 40.7128, - lng: -74.0060, + latitude: 40.7128, + longitude: -74.0060, ), ), ), @@ -350,8 +350,8 @@ class _MyAppState extends State { city: 'Los Angeles', street: '1234 Maple St', geoLocation: johnDoe.address.geoLocation.copyWith( - lat: 34.0522, - lng: -118.2437, + latitude: 34.0522, + longitude: -118.2437, ), ), ), @@ -372,8 +372,8 @@ class _MyAppState extends State { city: 'Springfield', zipCode: '12345-6789', geoLocation: johnDoe.address.geoLocation.copyWith( - lat: 37.1234, - lng: -122.1234, + latitude: 37.1234, + longitude: -122.1234, ), ), company: johnDoe.company.copyWith( @@ -398,8 +398,8 @@ class _MyAppState extends State { city: 'Springfield', zipCode: '12345-6789', geoLocation: johnDoe.address.geoLocation.copyWith( - lat: 37.1234, - lng: -122.1234, + latitude: 37.1234, + longitude: -122.1234, ), ), company: johnDoe.company.copyWith( diff --git a/examples/alice_chopper/lib/models/geo_location.dart b/examples/alice_chopper/lib/models/geo_location.dart index cb212d4e..973496c5 100644 --- a/examples/alice_chopper/lib/models/geo_location.dart +++ b/examples/alice_chopper/lib/models/geo_location.dart @@ -6,28 +6,30 @@ part 'geo_location.g.dart'; @JsonSerializable() class GeoLocation with EquatableMixin { const GeoLocation({ - required this.lat, - required this.lng, + required this.latitude, + required this.longitude, }); @JsonKey( + name: 'lat', fromJson: GeoLocation._stringToDouble, toJson: GeoLocation._doubleToString, ) - final double lat; + final double latitude; @JsonKey( + name: 'lng', fromJson: GeoLocation._stringToDouble, toJson: GeoLocation._doubleToString, ) - final double lng; + final double longitude; GeoLocation copyWith({ - double? lat, - double? lng, + double? latitude, + double? longitude, }) => GeoLocation( - lat: lat ?? this.lat, - lng: lng ?? this.lng, + latitude: latitude ?? this.latitude, + longitude: longitude ?? this.longitude, ); static String _doubleToString(double value) => value.toString(); @@ -40,5 +42,5 @@ class GeoLocation with EquatableMixin { Map toJson() => _$GeoLocationToJson(this); @override - List get props => [lat, lng]; + List get props => [latitude, longitude]; } diff --git a/examples/alice_chopper/lib/models/geo_location.g.dart b/examples/alice_chopper/lib/models/geo_location.g.dart index 146bfa4d..b9ca0016 100644 --- a/examples/alice_chopper/lib/models/geo_location.g.dart +++ b/examples/alice_chopper/lib/models/geo_location.g.dart @@ -7,12 +7,12 @@ part of 'geo_location.dart'; // ************************************************************************** GeoLocation _$GeoLocationFromJson(Map json) => GeoLocation( - lat: GeoLocation._stringToDouble(json['lat'] as String), - lng: GeoLocation._stringToDouble(json['lng'] as String), + latitude: GeoLocation._stringToDouble(json['lat'] as String), + longitude: GeoLocation._stringToDouble(json['lng'] as String), ); Map _$GeoLocationToJson(GeoLocation instance) => { - 'lat': GeoLocation._doubleToString(instance.lat), - 'lng': GeoLocation._doubleToString(instance.lng), + 'lat': GeoLocation._doubleToString(instance.latitude), + 'lng': GeoLocation._doubleToString(instance.longitude), };