From 5cd7c3fe34191d513a6e9fc393a6fb645999c4f0 Mon Sep 17 00:00:00 2001 From: Ketan Choyal Date: Wed, 31 Jan 2024 10:50:58 -0500 Subject: [PATCH] Fixed #88 and #86 --- CHANGELOG.md | 4 ++++ lib/models/retrieve_response.dart | 4 ++-- lib/models/retrieve_response.g.dart | 5 +++-- lib/models/suggestion_response.g.dart | 5 +++-- lib/src/geocoding_api.dart | 2 +- pubspec.yaml | 2 +- 6 files changed, 14 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e01f2e..d3caeb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# [4.2.2] - 31 Jan 2024 +- Fixed `externalIds` in `SuggestionResponse` and `RetrieveResonse` class and generated *.g.dart files again to include these changes. +- Fixed bug where `proximity` would always resolve to `NoProximity()` even when supplied with a value. + # [4.2.1] - 18 Jan 2024 - Fixed `externalIds` in `SuggestionResponse` class. Mapbox has changed the response for `externalIds` and it can be nullable now. diff --git a/lib/models/retrieve_response.dart b/lib/models/retrieve_response.dart index 37dda48..a532742 100644 --- a/lib/models/retrieve_response.dart +++ b/lib/models/retrieve_response.dart @@ -65,7 +65,7 @@ class RetrieveProperties { required this.bbox, required this.language, required this.maki, - required this.externalIds, + this.externalIds, required this.metadata, }); @@ -82,7 +82,7 @@ class RetrieveProperties { final BBox bbox; final String language; final String maki; - final ExternalIds externalIds; + final ExternalIds? externalIds; final ExternalIds metadata; factory RetrieveProperties.fromJson(Map json) => diff --git a/lib/models/retrieve_response.g.dart b/lib/models/retrieve_response.g.dart index 2593271..d39ad19 100644 --- a/lib/models/retrieve_response.g.dart +++ b/lib/models/retrieve_response.g.dart @@ -51,8 +51,9 @@ RetrieveProperties _$RetrievePropertiesFromJson(Map json) => bbox: const BBoxConverter().fromJson(json['bbox'] as List), language: json['language'] as String, maki: json['maki'] as String, - externalIds: - ExternalIds.fromJson(json['external_ids'] as Map), + externalIds: json['external_ids'] == null + ? null + : ExternalIds.fromJson(json['external_ids'] as Map), metadata: ExternalIds.fromJson(json['metadata'] as Map), ); diff --git a/lib/models/suggestion_response.g.dart b/lib/models/suggestion_response.g.dart index fd4f985..d2eae61 100644 --- a/lib/models/suggestion_response.g.dart +++ b/lib/models/suggestion_response.g.dart @@ -35,8 +35,9 @@ Suggestion _$SuggestionFromJson(Map json) => Suggestion( : Context.fromJson(json['context'] as Map), language: json['language'] as String, maki: json['maki'] as String?, - externalIds: - ExternalIds.fromJson(json['external_ids'] as Map), + externalIds: json['external_ids'] == null + ? null + : ExternalIds.fromJson(json['external_ids'] as Map), poiCategory: (json['poi_category'] as List?) ?.map((e) => e as String) .toList(), diff --git a/lib/src/geocoding_api.dart b/lib/src/geocoding_api.dart index e7327f2..c651de0 100644 --- a/lib/src/geocoding_api.dart +++ b/lib/src/geocoding_api.dart @@ -88,7 +88,7 @@ class GeoCoding { Location? location, Proximity proximity = const NoProximity(), }) async { - if (proximity is! Location) { + if (proximity is! LocationProximity) { proximity = location != null ? Proximity.Location(location) : const NoProximity(); } diff --git a/pubspec.yaml b/pubspec.yaml index 824cbd7..3b5cb5a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: mapbox_search description: A Flutter package for place search using MapBox Api and for Static map image -version: 4.2.1 +version: 4.2.2 homepage: https://github.com/ketanchoyal/mapbox_search