From da7b38247b365ce27410d87ed1eb7495a67827d0 Mon Sep 17 00:00:00 2001 From: Andrew Kurakov Date: Wed, 14 Feb 2024 17:01:48 +0700 Subject: [PATCH] fix: get first on empty list error in geocode_response; update dependency; bump version --- CHANGELOG.md | 4 ++++ lib/src/models/response/geocode_response.dart | 2 +- pubspec.yaml | 12 ++++++------ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b962490..af0659f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [2.2.1] +* Dependency update +* Fix get first on empty list error in geocode_response + ## [2.2.0] * Dart 3 support diff --git a/lib/src/models/response/geocode_response.dart b/lib/src/models/response/geocode_response.dart index aa67c20..b126f74 100644 --- a/lib/src/models/response/geocode_response.dart +++ b/lib/src/models/response/geocode_response.dart @@ -21,7 +21,7 @@ class GeocodeResponse with Comparer { _$GeocodeResponseFromJson(json); GeoObject? get _firstGeoObject => - response?.geoObjectCollection?.featureMember?.first.geoObject; + response?.geoObjectCollection?.featureMember?.firstOrNull?.geoObject; /// Первый адрес Address? get firstAddress => diff --git a/pubspec.yaml b/pubspec.yaml index 2e37c1e..6bd6d96 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: yandex_geocoder description: API to translate geographic coordinates into an address and vice versa -version: 2.2.0 +version: 2.2.1 repository: https://github.com/MadBrains/Yandex-Geocoder-Flutter issue_tracker: https://github.com/MadBrains/Yandex-Geocoder-Flutter/issues homepage: https://madbrains.ru/ @@ -9,13 +9,13 @@ environment: sdk: ">=3.0.0 <4.0.0" dependencies: - collection: ^1.17.1 - http: ^1.0.0 - json_annotation: ^4.8.0 + collection: ^1.18.0 + http: ^1.2.0 + json_annotation: ^4.8.1 dev_dependencies: - build_runner: ^2.4.0 + build_runner: ^2.4.8 flutter_test: sdk: flutter - json_serializable: ^6.6.1 + json_serializable: ^6.7.1 \ No newline at end of file