From d5a0c9057653cb2d3bce90f56ab226432258552b Mon Sep 17 00:00:00 2001 From: Kelven G Date: Fri, 13 Dec 2024 16:10:10 -0300 Subject: [PATCH 1/3] Use Object.all instead of hashValues --- mapbox_gl_platform_interface/lib/src/camera.dart | 2 +- mapbox_gl_platform_interface/lib/src/location.dart | 13 +++++-------- mapbox_gl_platform_interface/lib/src/ui.dart | 8 +++----- mapbox_gl_platform_interface/pubspec.yaml | 2 +- pubspec.yaml | 2 +- 5 files changed, 11 insertions(+), 16 deletions(-) diff --git a/mapbox_gl_platform_interface/lib/src/camera.dart b/mapbox_gl_platform_interface/lib/src/camera.dart index 3094923aa..8bf28ac52 100644 --- a/mapbox_gl_platform_interface/lib/src/camera.dart +++ b/mapbox_gl_platform_interface/lib/src/camera.dart @@ -80,7 +80,7 @@ class CameraPosition { } @override - int get hashCode => hashValues(bearing, target, tilt, zoom); + int get hashCode => Object.hashAll([bearing, target, tilt, zoom]); @override String toString() => diff --git a/mapbox_gl_platform_interface/lib/src/location.dart b/mapbox_gl_platform_interface/lib/src/location.dart index 7c058dda9..ffbf95a50 100644 --- a/mapbox_gl_platform_interface/lib/src/location.dart +++ b/mapbox_gl_platform_interface/lib/src/location.dart @@ -14,8 +14,7 @@ class LatLng { /// The longitude is normalized to the half-open interval from -180.0 /// (inclusive) to +180.0 (exclusive) const LatLng(double latitude, double longitude) - : latitude = - (latitude < -90.0 ? -90.0 : (90.0 < latitude ? 90.0 : latitude)), + : latitude = (latitude < -90.0 ? -90.0 : (90.0 < latitude ? 90.0 : latitude)), longitude = (longitude + 180.0) % 360.0 - 180.0; /// The latitude in degrees between -90.0 and 90.0, both inclusive. @@ -53,7 +52,7 @@ class LatLng { } @override - int get hashCode => hashValues(latitude, longitude); + int get hashCode => Object.hashAll([latitude, longitude]); } /// A latitude/longitude aligned rectangle. @@ -100,13 +99,11 @@ class LatLngBounds { @override bool operator ==(Object o) { - return o is LatLngBounds && - o.southwest == southwest && - o.northeast == northeast; + return o is LatLngBounds && o.southwest == southwest && o.northeast == northeast; } @override - int get hashCode => hashValues(southwest, northeast); + int get hashCode => Object.hashAll([southwest, northeast]); } /// A geographical area representing a non-aligned quadrilateral @@ -164,7 +161,7 @@ class LatLngQuad { } @override - int get hashCode => hashValues(topLeft, topRight, bottomRight, bottomLeft); + int get hashCode => Object.hashAll([topLeft, topRight, bottomRight, bottomLeft]); } /// User's observed location diff --git a/mapbox_gl_platform_interface/lib/src/ui.dart b/mapbox_gl_platform_interface/lib/src/ui.dart index 5bacf8a08..93fc6d575 100644 --- a/mapbox_gl_platform_interface/lib/src/ui.dart +++ b/mapbox_gl_platform_interface/lib/src/ui.dart @@ -29,8 +29,7 @@ class MapboxStyles { /// Satellite Streets: Global satellite and aerial imagery with unobtrusive labels. Using this /// constant means your map style will always use the latest version and may change as we /// improve the style. - static const String SATELLITE_STREETS = - "mapbox://styles/mapbox/satellite-streets-v11"; + static const String SATELLITE_STREETS = "mapbox://styles/mapbox/satellite-streets-v11"; /// Traffic Day: Color-coded roads based on live traffic congestion data. Traffic data is currently /// available in @@ -129,8 +128,7 @@ class MinMaxZoomPreference { final double? maxZoom; /// Unbounded zooming. - static const MinMaxZoomPreference unbounded = - MinMaxZoomPreference(null, null); + static const MinMaxZoomPreference unbounded = MinMaxZoomPreference(null, null); dynamic toJson() => [minZoom, maxZoom]; @@ -143,7 +141,7 @@ class MinMaxZoomPreference { } @override - int get hashCode => hashValues(minZoom, maxZoom); + int get hashCode => Object.hashAll([minZoom, maxZoom]); @override String toString() { diff --git a/mapbox_gl_platform_interface/pubspec.yaml b/mapbox_gl_platform_interface/pubspec.yaml index c3eae26be..cd1269fc2 100644 --- a/mapbox_gl_platform_interface/pubspec.yaml +++ b/mapbox_gl_platform_interface/pubspec.yaml @@ -9,5 +9,5 @@ dependencies: meta: ^1.0.5 environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.14.0 <3.0.0' flutter: ">=2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index ea086f30b..d14c36b8e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -34,6 +34,6 @@ flutter: default_package: mapbox_gl_web environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.14.0 <3.0.0' # Flutter versions prior to 1.10 did not support the flutter.plugin.platforms map. flutter: ">=2.0.0" From f41c82922eddecb954f474756ededd85c9ade844 Mon Sep 17 00:00:00 2001 From: Kelven G Date: Mon, 16 Dec 2024 14:50:38 -0300 Subject: [PATCH 2/3] Use Object.hash instead of .hashAll --- mapbox_gl_platform_interface/lib/src/camera.dart | 2 +- mapbox_gl_platform_interface/lib/src/location.dart | 6 +++--- mapbox_gl_platform_interface/lib/src/ui.dart | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mapbox_gl_platform_interface/lib/src/camera.dart b/mapbox_gl_platform_interface/lib/src/camera.dart index 8bf28ac52..0c49e3371 100644 --- a/mapbox_gl_platform_interface/lib/src/camera.dart +++ b/mapbox_gl_platform_interface/lib/src/camera.dart @@ -80,7 +80,7 @@ class CameraPosition { } @override - int get hashCode => Object.hashAll([bearing, target, tilt, zoom]); + int get hashCode => Object.hash(bearing, target, tilt, zoom); @override String toString() => diff --git a/mapbox_gl_platform_interface/lib/src/location.dart b/mapbox_gl_platform_interface/lib/src/location.dart index ffbf95a50..74be58396 100644 --- a/mapbox_gl_platform_interface/lib/src/location.dart +++ b/mapbox_gl_platform_interface/lib/src/location.dart @@ -52,7 +52,7 @@ class LatLng { } @override - int get hashCode => Object.hashAll([latitude, longitude]); + int get hashCode => Object.hash(latitude, longitude); } /// A latitude/longitude aligned rectangle. @@ -103,7 +103,7 @@ class LatLngBounds { } @override - int get hashCode => Object.hashAll([southwest, northeast]); + int get hashCode => Object.hash(southwest, northeast); } /// A geographical area representing a non-aligned quadrilateral @@ -161,7 +161,7 @@ class LatLngQuad { } @override - int get hashCode => Object.hashAll([topLeft, topRight, bottomRight, bottomLeft]); + int get hashCode => Object.hash(topLeft, topRight, bottomRight, bottomLeft); } /// User's observed location diff --git a/mapbox_gl_platform_interface/lib/src/ui.dart b/mapbox_gl_platform_interface/lib/src/ui.dart index 93fc6d575..54173725b 100644 --- a/mapbox_gl_platform_interface/lib/src/ui.dart +++ b/mapbox_gl_platform_interface/lib/src/ui.dart @@ -141,7 +141,7 @@ class MinMaxZoomPreference { } @override - int get hashCode => Object.hashAll([minZoom, maxZoom]); + int get hashCode => Object.hash(minZoom, maxZoom); @override String toString() { From ddcc256a6b178704b928cc05d27acbf205e3cc33 Mon Sep 17 00:00:00 2001 From: Kelven G Date: Mon, 16 Dec 2024 14:51:17 -0300 Subject: [PATCH 3/3] dart format --- mapbox_gl_platform_interface/lib/src/location.dart | 7 +++++-- mapbox_gl_platform_interface/lib/src/ui.dart | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/mapbox_gl_platform_interface/lib/src/location.dart b/mapbox_gl_platform_interface/lib/src/location.dart index 74be58396..879cd74cf 100644 --- a/mapbox_gl_platform_interface/lib/src/location.dart +++ b/mapbox_gl_platform_interface/lib/src/location.dart @@ -14,7 +14,8 @@ class LatLng { /// The longitude is normalized to the half-open interval from -180.0 /// (inclusive) to +180.0 (exclusive) const LatLng(double latitude, double longitude) - : latitude = (latitude < -90.0 ? -90.0 : (90.0 < latitude ? 90.0 : latitude)), + : latitude = + (latitude < -90.0 ? -90.0 : (90.0 < latitude ? 90.0 : latitude)), longitude = (longitude + 180.0) % 360.0 - 180.0; /// The latitude in degrees between -90.0 and 90.0, both inclusive. @@ -99,7 +100,9 @@ class LatLngBounds { @override bool operator ==(Object o) { - return o is LatLngBounds && o.southwest == southwest && o.northeast == northeast; + return o is LatLngBounds && + o.southwest == southwest && + o.northeast == northeast; } @override diff --git a/mapbox_gl_platform_interface/lib/src/ui.dart b/mapbox_gl_platform_interface/lib/src/ui.dart index 54173725b..6a766d8fa 100644 --- a/mapbox_gl_platform_interface/lib/src/ui.dart +++ b/mapbox_gl_platform_interface/lib/src/ui.dart @@ -29,7 +29,8 @@ class MapboxStyles { /// Satellite Streets: Global satellite and aerial imagery with unobtrusive labels. Using this /// constant means your map style will always use the latest version and may change as we /// improve the style. - static const String SATELLITE_STREETS = "mapbox://styles/mapbox/satellite-streets-v11"; + static const String SATELLITE_STREETS = + "mapbox://styles/mapbox/satellite-streets-v11"; /// Traffic Day: Color-coded roads based on live traffic congestion data. Traffic data is currently /// available in @@ -128,7 +129,8 @@ class MinMaxZoomPreference { final double? maxZoom; /// Unbounded zooming. - static const MinMaxZoomPreference unbounded = MinMaxZoomPreference(null, null); + static const MinMaxZoomPreference unbounded = + MinMaxZoomPreference(null, null); dynamic toJson() => [minZoom, maxZoom];