From 44b72b6017123e70d14190fe016a9ba9722aa82f Mon Sep 17 00:00:00 2001 From: Sacha STAFYNIAK Date: Mon, 14 Oct 2024 15:52:44 +0200 Subject: [PATCH] replace pedantic with lints --- analysis_options.yaml | 6 +++++- lib/src/navigation/directions.dart | 12 ++++++------ lib/src/navigation/isochrome.dart | 10 +++++----- lib/src/navigation/map_matching.dart | 6 +++--- lib/src/navigation/matrix.dart | 4 ++-- lib/src/navigation/optimization.dart | 6 +++--- lib/src/search/forward_geocoding.dart | 8 ++++---- lib/src/search/globals.dart | 6 +++--- lib/src/search/intersection.dart | 4 ++-- lib/src/search/reverse_geocoding.dart | 8 ++++---- pubspec.yaml | 2 +- 11 files changed, 38 insertions(+), 34 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index d4fcc1a..24c3773 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1 +1,5 @@ -include: package:pedantic/analysis_options.yaml \ No newline at end of file +include: package:lints/recommended.yaml + +linter: + rules: + constant_identifier_names: false diff --git a/lib/src/navigation/directions.dart b/lib/src/navigation/directions.dart index 5c643d1..044885e 100644 --- a/lib/src/navigation/directions.dart +++ b/lib/src/navigation/directions.dart @@ -42,7 +42,7 @@ class DirectionsApi { double walkwayBias = 0, double alleyBias = 0, }) async { - var url = endpoint + '/' + version; + var url = '$endpoint/$version'; if (profile != null) { switch (profile) { @@ -75,22 +75,22 @@ class DirectionsApi { } } - url += '?access_token=' + api.accessToken!; + url += '?access_token=${api.accessToken!}'; if (profile == NavigationProfile.WALKING) { if (walkingSpeed != 1.42) { - url += '&walking_speed=' + walkingSpeed.toString(); + url += '&walking_speed=$walkingSpeed'; } if (walkwayBias != 0) { - url += '&walkway_bias=' + walkwayBias.toString(); + url += '&walkway_bias=$walkwayBias'; } if (alleyBias != 0) { - url += '&alley_bias=' + alleyBias.toString(); + url += '&alley_bias=$alleyBias'; } } if (language != 'en') { - url += '&language=' + language; + url += '&language=$language'; } if (steps) { url += '&steps=true'; diff --git a/lib/src/navigation/isochrome.dart b/lib/src/navigation/isochrome.dart index 4f84ec0..daddbf2 100644 --- a/lib/src/navigation/isochrome.dart +++ b/lib/src/navigation/isochrome.dart @@ -29,7 +29,7 @@ class IsochroneApi { double denoise = 1.0, double? generalize, }) async { - var url = endpoint + '/' + version; + var url = '$endpoint/$version'; if (profile != null) { switch (profile) { @@ -53,7 +53,7 @@ class IsochroneApi { url += ','; url += coordinates[LATITUDE].toString(); - url += '?access_token=' + api.accessToken!; + url += '?access_token=${api.accessToken!}'; for (var i = 0; i < contoursMinutes.length; i++) { if (i == 0) { @@ -122,10 +122,10 @@ class IsochroneApiResponse { } IsochroneApiResponse.fromJson(Map json) { - final _message = json['message'] as String?; + final message = json['message'] as String?; - if (_message != null) { - error = NavigationError(message: _message); + if (message != null) { + error = NavigationError(message: message); } code = json['code'] as String?; diff --git a/lib/src/navigation/map_matching.dart b/lib/src/navigation/map_matching.dart index f6fee4a..6bce5e8 100644 --- a/lib/src/navigation/map_matching.dart +++ b/lib/src/navigation/map_matching.dart @@ -33,7 +33,7 @@ class MapMatchingApi { List waypointNames = const [], List> waypoints = const >[], }) async { - var url = endpoint + '/' + version; + var url = '$endpoint/$version'; if (profile != null) { switch (profile) { @@ -68,10 +68,10 @@ class MapMatchingApi { } } - url += '?access_token=' + api.accessToken!; + url += '?access_token=${api.accessToken!}'; if (language != 'en') { - url += '&language=' + language; + url += '&language=$language'; } if (steps) { url += '&steps=true'; diff --git a/lib/src/navigation/matrix.dart b/lib/src/navigation/matrix.dart index dd267cf..7c3d30f 100644 --- a/lib/src/navigation/matrix.dart +++ b/lib/src/navigation/matrix.dart @@ -34,7 +34,7 @@ class MatrixApi { int fallbackSpeed = 0, List sources = const [], }) async { - var url = endpoint + '/' + version; + var url = '$endpoint/$version'; if (profile != null) { switch (profile) { @@ -67,7 +67,7 @@ class MatrixApi { } } - url += '?access_token=' + api.accessToken!; + url += '?access_token=${api.accessToken!}'; for (var i = 0; i < annotations.length; i++) { if (i == 0) { diff --git a/lib/src/navigation/optimization.dart b/lib/src/navigation/optimization.dart index 22e790f..6c9d22a 100644 --- a/lib/src/navigation/optimization.dart +++ b/lib/src/navigation/optimization.dart @@ -33,7 +33,7 @@ class OptimizationApi { bool steps = false, bool roundtrip = true, }) async { - var url = endpoint + '/' + version; + var url = '$endpoint/$version'; if (profile != null) { switch (profile) { @@ -66,10 +66,10 @@ class OptimizationApi { } } - url += '?access_token=' + api.accessToken!; + url += '?access_token=${api.accessToken!}'; if (language != 'en') { - url += '&language=' + language; + url += '&language=$language'; } if (steps) { url += '&steps=true'; diff --git a/lib/src/search/forward_geocoding.dart b/lib/src/search/forward_geocoding.dart index e4a1972..fe67226 100644 --- a/lib/src/search/forward_geocoding.dart +++ b/lib/src/search/forward_geocoding.dart @@ -30,7 +30,7 @@ class ForwardGeocodingApi { bool routing = false, List types = const [], }) async { - var url = this.endpoint + '/' + version; + var url = '${this.endpoint}/$version'; if (endpoint == GeocoderEndpoint.PLACES_PERMANENT) { url += '/mapbox.places-permanent'; @@ -78,7 +78,7 @@ class ForwardGeocodingApi { bool routing = false, List types = const [], }) async { - var url = this.endpoint + '/' + version; + var url = '${this.endpoint}/$version'; if (endpoint == GeocoderEndpoint.PLACES_PERMANENT) { url += '/mapbox.places-permanent'; @@ -141,7 +141,7 @@ class ForwardGeocodingApi { bool? routing, List? types, }) { - var url = '?access_token=' + api.accessToken!; + var url = '?access_token=${api.accessToken!}'; if (autocomplete != null && !autocomplete) { url += '&autocomplete=false'; @@ -156,7 +156,7 @@ class ForwardGeocodingApi { } if (language != null) { - url += '&language=' + language; + url += '&language=$language'; } if (limit != null && limit != 5) { diff --git a/lib/src/search/globals.dart b/lib/src/search/globals.dart index 13772cb..4b65147 100644 --- a/lib/src/search/globals.dart +++ b/lib/src/search/globals.dart @@ -352,10 +352,10 @@ class GeocodingApiResponse { } GeocodingApiResponse.fromJson(Map json) { - final _message = json['message'] as String?; + final message = json['message'] as String?; - if (_message != null) { - error = GeocoderError(message: _message); + if (message != null) { + error = GeocoderError(message: message); } type = json['type'] as String?; diff --git a/lib/src/search/intersection.dart b/lib/src/search/intersection.dart index a780400..07e1f6d 100644 --- a/lib/src/search/intersection.dart +++ b/lib/src/search/intersection.dart @@ -24,7 +24,7 @@ class IntersectionApi { List proximity = const [], List types = const [], }) async { - var url = this.endpoint + '/' + version; + var url = '${this.endpoint}/$version'; if (endpoint == GeocoderEndpoint.PLACES_PERMANENT) { url += '/mapbox.places-permanent'; @@ -33,7 +33,7 @@ class IntersectionApi { } url += '/$street1 and $street2.json'; - url += '?access_token=' + api.accessToken!; + url += '?access_token=${api.accessToken!}'; if (types.isNotEmpty) { for (var i = 0; i < types.length; i++) { diff --git a/lib/src/search/reverse_geocoding.dart b/lib/src/search/reverse_geocoding.dart index f08943e..6bbfe74 100644 --- a/lib/src/search/reverse_geocoding.dart +++ b/lib/src/search/reverse_geocoding.dart @@ -28,7 +28,7 @@ class ReverseGeocodingApi { bool routing = false, List types = const [], }) async { - var url = this.endpoint + '/' + version; + var url = '${this.endpoint}/$version'; if (endpoint == GeocoderEndpoint.PLACES_PERMANENT) { url += '/mapbox.places-permanent'; @@ -70,7 +70,7 @@ class ReverseGeocodingApi { bool routing = false, List types = const [], }) async { - var url = this.endpoint + '/' + version; + var url = '${this.endpoint}/$version'; if (endpoint == GeocoderEndpoint.PLACES_PERMANENT) { url += '/mapbox.places-permanent'; @@ -127,14 +127,14 @@ class ReverseGeocodingApi { bool? routing, List? types, }) { - var url = '?access_token=' + api.accessToken!; + var url = '?access_token=${api.accessToken!}'; if (routing != null && routing) { url += '&routing=true'; } if (language != null) { - url += '&language=' + language; + url += '&language=$language'; } if (limit != null && limit != 5) { diff --git a/pubspec.yaml b/pubspec.yaml index 0537f79..2c2b6c9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -7,7 +7,7 @@ dependencies: http: ^1.2.0 dev_dependencies: - pedantic: ^1.9.2 + lints: ^5.0.0 environment: sdk: '>=2.12.0 <3.0.0' \ No newline at end of file