From 9cf77f2f15f5eb9f19f311ff73cba16f946946f0 Mon Sep 17 00:00:00 2001 From: androidseb Date: Sat, 7 Jun 2025 11:15:49 +0200 Subject: [PATCH 1/9] Added region to search params and title + description to search results --- geocoding/android/build.gradle | 1 + .../com/baseflow/geocoding/Geocoding.java | 21 ++- .../geocoding/MethodCallHandlerImpl.java | 38 +++++- .../geocoding/utils/AddressMapper.java | 12 ++ .../Extensions/CLPlacemarkExtensions.m | 4 + geocoding/ios/Classes/GeocodingHandler.h | 4 + geocoding/ios/Classes/GeocodingHandler.m | 19 ++- geocoding/ios/Classes/GeocodingPlugin.m | 14 ++ geocoding/lib/geocoding.dart | 2 + geocoding/pubspec.yaml | 5 +- geocoding/test/geocoding_test.dart | 3 + .../lib/src/geocoding_platform_interface.dart | 1 + .../method_channel_geocoding.dart | 9 +- .../lib/src/models/location.dart | 20 ++- .../lib/src/models/models.dart | 1 + .../lib/src/models/placemark.dart | 2 +- .../lib/src/models/region.dart | 126 ++++++++++++++++++ geocoding_platform_interface/pubspec.yaml | 2 + .../method_channel_geocoding_test.dart | 3 +- .../test/src/models/location_test.dart | 18 +++ 20 files changed, 292 insertions(+), 13 deletions(-) create mode 100644 geocoding_platform_interface/lib/src/models/region.dart diff --git a/geocoding/android/build.gradle b/geocoding/android/build.gradle index 6e41fe8..a18f68b 100644 --- a/geocoding/android/build.gradle +++ b/geocoding/android/build.gradle @@ -22,6 +22,7 @@ rootProject.allprojects { apply plugin: 'com.android.library' android { + namespace 'com.baseflow.geocoding' compileSdkVersion 31 defaultConfig { diff --git a/geocoding/android/src/main/java/com/baseflow/geocoding/Geocoding.java b/geocoding/android/src/main/java/com/baseflow/geocoding/Geocoding.java index 9c05dc5..969c36d 100644 --- a/geocoding/android/src/main/java/com/baseflow/geocoding/Geocoding.java +++ b/geocoding/android/src/main/java/com/baseflow/geocoding/Geocoding.java @@ -30,10 +30,25 @@ class Geocoding { * @return a list of Address objects. Returns null or empty list if no matches were found or there is no backend service available. * @throws java.io.IOException if the network is unavailable or any other I/O problem occurs. */ - List
placemarkFromAddress(String address, Locale locale) throws IOException { - + List
placemarkFromAddress(String address, + Locale locale, + Double lowerLeftLatitude, + Double lowerLeftLongitude, + Double upperRightLatitude, + Double upperRightLongitude) throws IOException { final Geocoder geocoder = createGeocoder(androidContext, locale); - return geocoder.getFromLocationName(address, 5); + if (lowerLeftLatitude == null || lowerLeftLongitude == null || upperRightLatitude == null || upperRightLongitude == null) { + return geocoder.getFromLocationName(address, 5); + }else { + return geocoder.getFromLocationName( + address, + 5, + lowerLeftLatitude, + lowerLeftLongitude, + upperRightLatitude, + upperRightLongitude + ); + } } /** diff --git a/geocoding/android/src/main/java/com/baseflow/geocoding/MethodCallHandlerImpl.java b/geocoding/android/src/main/java/com/baseflow/geocoding/MethodCallHandlerImpl.java index 40a502f..775e983 100644 --- a/geocoding/android/src/main/java/com/baseflow/geocoding/MethodCallHandlerImpl.java +++ b/geocoding/android/src/main/java/com/baseflow/geocoding/MethodCallHandlerImpl.java @@ -1,6 +1,7 @@ package com.baseflow.geocoding; import android.location.Address; +import android.os.AsyncTask; import android.util.Log; import androidx.annotation.Nullable; @@ -31,13 +32,23 @@ final class MethodCallHandlerImpl implements MethodCallHandler { } @Override - public void onMethodCall(MethodCall call, Result result) { + public void onMethodCall(final MethodCall call, final Result result) { switch (call.method) { case "locationFromAddress": - onLocationFromAddress(call, result); + AsyncTask.execute(new Runnable() { + @Override + public void run() { + onLocationFromAddress(call, result); + } + }); break; case "placemarkFromCoordinates": - onPlacemarkFromCoordinates(call, result); + AsyncTask.execute(new Runnable() { + @Override + public void run() { + onPlacemarkFromCoordinates(call, result); + } + }); break; default: result.notImplemented(); @@ -77,9 +88,23 @@ void stopListening() { channel = null; } + // Parses a string as a double and returns the parsed value. + // If parsing is not possible or fails, returns null. + private static Double parseDoubleOrReturnNull(final String _string){ + try{ + return Double.parseDouble(_string); + }catch (Throwable t){ + return null; + } + } + private void onLocationFromAddress(MethodCall call, Result result) { final String address = call.argument("address"); final String languageTag = call.argument("localeIdentifier"); + final String targetRegionSLat = call.argument("targetRegionSLat"); + final String targetRegionNLat = call.argument("targetRegionNLat"); + final String targetRegionWLng = call.argument("targetRegionWLng"); + final String targetRegionELng = call.argument("targetRegionELng"); if (address == null || address.isEmpty()) { result.error( @@ -91,7 +116,12 @@ private void onLocationFromAddress(MethodCall call, Result result) { try { final List
addresses = geocoding.placemarkFromAddress( address, - LocaleConverter.fromLanguageTag(languageTag)); + LocaleConverter.fromLanguageTag(languageTag), + parseDoubleOrReturnNull(targetRegionSLat), // lowerLeftLatitude, + parseDoubleOrReturnNull(targetRegionWLng), // lowerLeftLongitude, + parseDoubleOrReturnNull(targetRegionNLat), // upperRightLatitude, + parseDoubleOrReturnNull(targetRegionELng) // upperRightLongitude + ); if (addresses == null || addresses.isEmpty()) { result.error( diff --git a/geocoding/android/src/main/java/com/baseflow/geocoding/utils/AddressMapper.java b/geocoding/android/src/main/java/com/baseflow/geocoding/utils/AddressMapper.java index afe3ec3..c43e46c 100644 --- a/geocoding/android/src/main/java/com/baseflow/geocoding/utils/AddressMapper.java +++ b/geocoding/android/src/main/java/com/baseflow/geocoding/utils/AddressMapper.java @@ -55,6 +55,18 @@ public static List> toLocationHashMapList(List
addr private static Map toLocationHashmap(Address address) { Map location = new HashMap<>(); + location.put("title", address.getFeatureName()); + { + final int maxAddressLineIndex = address.getMaxAddressLineIndex(); + final StringBuilder descriptionString = new StringBuilder(); + for (int i = 0; i <= maxAddressLineIndex; i++) { + if (i > 0) { + descriptionString.append("\n"); + } + descriptionString.append(address.getAddressLine(i)); + } + location.put("description", descriptionString.toString()); + } location.put("latitude", address.getLatitude()); location.put("longitude", address.getLongitude()); location.put("timestamp", Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTimeInMillis()); diff --git a/geocoding/ios/Classes/Extensions/CLPlacemarkExtensions.m b/geocoding/ios/Classes/Extensions/CLPlacemarkExtensions.m index 6102bf0..0ab14e3 100644 --- a/geocoding/ios/Classes/Extensions/CLPlacemarkExtensions.m +++ b/geocoding/ios/Classes/Extensions/CLPlacemarkExtensions.m @@ -45,8 +45,12 @@ - (NSDictionary *)toLocationDictionary { if (self.location == nil) { return nil; } + + NSArray *lines = self.addressDictionary[@"FormattedAddressLines"]; NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithDictionary:@{ + @"title": self.name, + @"description": [lines componentsJoinedByString:@", "] ?: [NSNull null], @"latitude": @(self.location.coordinate.latitude), @"longitude": @(self.location.coordinate.longitude), @"timestamp": @([CLPlacemark currentTimeInMilliSeconds: self.location.timestamp]), diff --git a/geocoding/ios/Classes/GeocodingHandler.h b/geocoding/ios/Classes/GeocodingHandler.h index 9f0b25c..6e140e0 100644 --- a/geocoding/ios/Classes/GeocodingHandler.h +++ b/geocoding/ios/Classes/GeocodingHandler.h @@ -17,6 +17,10 @@ typedef void (^GeocodingFailure)(NSString* errorCode, NSString* errorDescription - (void) geocodeFromAddress: (NSString *)address locale: (NSLocale *)locale + sLat: (CGFloat)sLat + wLng: (CGFloat)sLng + nLat: (CGFloat)nLat + eLng: (CGFloat)nLng success: (_Nonnull GeocodingSuccess)successHandler failure: (_Nonnull GeocodingFailure)failureHandler; diff --git a/geocoding/ios/Classes/GeocodingHandler.m b/geocoding/ios/Classes/GeocodingHandler.m index 504231c..f1ff9ac 100644 --- a/geocoding/ios/Classes/GeocodingHandler.m +++ b/geocoding/ios/Classes/GeocodingHandler.m @@ -23,6 +23,10 @@ - (id)init { - (void) geocodeFromAddress: (NSString *)address locale: (NSLocale *)locale + sLat: (CGFloat) sLat + wLng: (CGFloat) sLng + nLat: (CGFloat) nLat + eLng: (CGFloat) nLng success: (GeocodingSuccess)successHandler failure: (GeocodingFailure)failureHandler { @@ -31,9 +35,21 @@ - (void) geocodeFromAddress: (NSString *)address return; } + CLRegion* region; + if (sLat == 0 || sLng == 0 || nLat == 0 || nLng == 0){ + region = nil; + }else{ + CLLocationCoordinate2D center = CLLocationCoordinate2DMake(sLat + (nLat-sLat) / 2, sLng + (nLng-sLng) / 2); + //Computing the radius based on lat delta, since 1 lat = 111 km no matter the location + float latDelta = nLat - sLat; + float radiusLat = (latDelta/2); + float radius = radiusLat * 111000; + region = [[CLCircularRegion alloc] initWithCenter:center radius:radius identifier:@"Search Radius"]; + } + if (@available(iOS 11.0, *)) { [_geocoder geocodeAddressString:address - inRegion:nil + inRegion:region preferredLocale:locale completionHandler:^(NSArray< CLPlacemark *> *__nullable placemarks, NSError *__nullable error) { @@ -53,6 +69,7 @@ - (void) geocodeFromAddress: (NSString *)address } [_geocoder geocodeAddressString:address + inRegion:region completionHandler:^(NSArray< CLPlacemark *> *__nullable placemarks, NSError *__nullable error) { [GeocodingHandler completeGeocodingWith:placemarks diff --git a/geocoding/ios/Classes/GeocodingPlugin.m b/geocoding/ios/Classes/GeocodingPlugin.m index e66d2f0..09504e7 100644 --- a/geocoding/ios/Classes/GeocodingPlugin.m +++ b/geocoding/ios/Classes/GeocodingPlugin.m @@ -18,13 +18,27 @@ + (void)registerWithRegistrar:(NSObject*)registrar { [registrar addMethodCallDelegate:instance channel:channel]; } ++ (CGFloat) parseCGFloat:(NSString*)numberString { + NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; + formatter.numberStyle=NSNumberFormatterDecimalStyle; + return [[formatter numberFromString:numberString] doubleValue]; +} + - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { if ([@"locationFromAddress" isEqualToString:call.method]) { NSString* address = call.arguments[@"address"]; + NSString* targetRegionSLat = call.arguments[@"targetRegionSLat"]; + NSString* targetRegionNLat = call.arguments[@"targetRegionNLat"]; + NSString* targetRegionWLng = call.arguments[@"targetRegionWLng"]; + NSString* targetRegionELng = call.arguments[@"targetRegionELng"]; GeocodingHandler* handler = [[GeocodingHandler alloc] init]; [handler geocodeFromAddress:address locale:[GeocodingPlugin parseLocale: call.arguments] + sLat:[GeocodingPlugin parseCGFloat: targetRegionSLat] + wLng:[GeocodingPlugin parseCGFloat: targetRegionWLng] + nLat:[GeocodingPlugin parseCGFloat: targetRegionNLat] + eLng:[GeocodingPlugin parseCGFloat: targetRegionELng] success:^(NSArray * placemarks) { result([GeocodingPlugin toLocationResult: placemarks]); } diff --git a/geocoding/lib/geocoding.dart b/geocoding/lib/geocoding.dart index eec7c4b..00404ab 100644 --- a/geocoding/lib/geocoding.dart +++ b/geocoding/lib/geocoding.dart @@ -17,10 +17,12 @@ export 'package:geocoding_platform_interface/geocoding_platform_interface.dart'; /// [languageCode]_[countryCode] (eg. en_US or nl_NL). Future> locationFromAddress( String address, { + Region? targetRegion, String? localeIdentifier, }) => GeocodingPlatform.instance.locationFromAddress( address, + targetRegion: targetRegion, localeIdentifier: localeIdentifier, ); diff --git a/geocoding/pubspec.yaml b/geocoding/pubspec.yaml index aff08a8..5436445 100644 --- a/geocoding/pubspec.yaml +++ b/geocoding/pubspec.yaml @@ -3,6 +3,8 @@ description: A Flutter Geocoding plugin which provides easy geocoding and revers version: 2.0.4 homepage: https://github.com/baseflow/flutter-geocoding/tree/master/geocoding +publish_to: 'none' + environment: sdk: '>=2.12.0 <3.0.0' flutter: ">=1.10.0" @@ -11,7 +13,8 @@ dependencies: flutter: sdk: flutter - geocoding_platform_interface: ^2.0.0 + geocoding_platform_interface: + path: ../geocoding_platform_interface dev_dependencies: flutter_test: diff --git a/geocoding/test/geocoding_test.dart b/geocoding/test/geocoding_test.dart index 752892a..da21050 100644 --- a/geocoding/test/geocoding_test.dart +++ b/geocoding/test/geocoding_test.dart @@ -4,6 +4,8 @@ import 'package:mockito/mockito.dart'; import 'package:plugin_platform_interface/plugin_platform_interface.dart'; final mockLocation = Location( + title: '', + description: '', latitude: 52.2165157, longitude: 6.9437819, timestamp: DateTime.fromMillisecondsSinceEpoch(0).toUtc(), @@ -49,6 +51,7 @@ class MockGeocodingPlatform extends Mock @override Future> locationFromAddress( String address, { + Region? targetRegion, String? localeIdentifier, }) async { return [mockLocation]; diff --git a/geocoding_platform_interface/lib/src/geocoding_platform_interface.dart b/geocoding_platform_interface/lib/src/geocoding_platform_interface.dart index 345735c..cf58f17 100644 --- a/geocoding_platform_interface/lib/src/geocoding_platform_interface.dart +++ b/geocoding_platform_interface/lib/src/geocoding_platform_interface.dart @@ -44,6 +44,7 @@ abstract class GeocodingPlatform extends PlatformInterface { /// [languageCode]_[countryCode] (eg. en_US or nl_NL). Future> locationFromAddress( String address, { + Region? targetRegion, String? localeIdentifier, }) { throw UnimplementedError( diff --git a/geocoding_platform_interface/lib/src/implementations/method_channel_geocoding.dart b/geocoding_platform_interface/lib/src/implementations/method_channel_geocoding.dart index f85d533..3b022a3 100644 --- a/geocoding_platform_interface/lib/src/implementations/method_channel_geocoding.dart +++ b/geocoding_platform_interface/lib/src/implementations/method_channel_geocoding.dart @@ -1,7 +1,7 @@ import 'dart:async'; +import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; -import 'package:meta/meta.dart'; import '../errors/errors.dart'; import '../geocoding_platform_interface.dart'; @@ -16,12 +16,19 @@ class MethodChannelGeocoding extends GeocodingPlatform { @override Future> locationFromAddress( String address, { + Region? targetRegion, String? localeIdentifier, }) async { final parameters = { 'address': address, }; + if (targetRegion != null) { + parameters['targetRegionSLat'] = '${targetRegion.southLatitude}'; + parameters['targetRegionNLat'] = '${targetRegion.northLatitude}'; + parameters['targetRegionWLng'] = '${targetRegion.westLongitude}'; + parameters['targetRegionELng'] = '${targetRegion.eastLongitude}'; + } if (localeIdentifier != null) { parameters['localeIdentifier'] = localeIdentifier; } diff --git a/geocoding_platform_interface/lib/src/models/location.dart b/geocoding_platform_interface/lib/src/models/location.dart index 05d169f..bed2e3a 100644 --- a/geocoding_platform_interface/lib/src/models/location.dart +++ b/geocoding_platform_interface/lib/src/models/location.dart @@ -1,4 +1,4 @@ -import 'package:meta/meta.dart'; +import 'package:flutter/foundation.dart'; /// Contains detailed location information. @immutable @@ -7,17 +7,27 @@ class Location { /// instances constructed this way won't actually reflect any real information /// from the platform, just whatever was passed in at construction time. Location({ + required this.title, + required this.description, required this.latitude, required this.longitude, required this.timestamp, }); Location._({ + required this.title, + required this.description, required this.latitude, required this.longitude, required this.timestamp, }); + /// The title associated with the placemark, might be empty + final String title; + + /// The description associated with the placemark, might be empty + final String description; + /// The latitude associated with the placemark. final double latitude; @@ -30,6 +40,8 @@ class Location { @override bool operator ==(dynamic o) => o is Location && + o.title == title && + o.description == description && o.latitude == latitude && o.longitude == longitude && o.timestamp == timestamp; @@ -65,6 +77,8 @@ class Location { } return Location._( + title: locationMap['title'] ?? '', + description: locationMap['description'] ?? '', latitude: locationMap['latitude'], longitude: locationMap['longitude'], timestamp: timestamp, @@ -74,6 +88,8 @@ class Location { /// Converts the [Location] instance into a [Map] instance that can be /// serialized to JSON. Map toJson() => { + 'title': title, + 'description': description, 'latitude': latitude, 'longitude': longitude, 'timestamp': timestamp.millisecondsSinceEpoch, @@ -82,6 +98,8 @@ class Location { @override String toString() { return ''' + Title: $title, + Description: $description, Latitude: $latitude, Longitude: $longitude, Timestamp: $timestamp'''; diff --git a/geocoding_platform_interface/lib/src/models/models.dart b/geocoding_platform_interface/lib/src/models/models.dart index f26554a..9dde598 100644 --- a/geocoding_platform_interface/lib/src/models/models.dart +++ b/geocoding_platform_interface/lib/src/models/models.dart @@ -1,2 +1,3 @@ export 'location.dart'; export 'placemark.dart'; +export 'region.dart'; diff --git a/geocoding_platform_interface/lib/src/models/placemark.dart b/geocoding_platform_interface/lib/src/models/placemark.dart index 2a9c9e3..3bec78b 100644 --- a/geocoding_platform_interface/lib/src/models/placemark.dart +++ b/geocoding_platform_interface/lib/src/models/placemark.dart @@ -1,4 +1,4 @@ -import 'package:meta/meta.dart'; +import 'package:flutter/foundation.dart'; /// Contains detailed placemark information. @immutable diff --git a/geocoding_platform_interface/lib/src/models/region.dart b/geocoding_platform_interface/lib/src/models/region.dart new file mode 100644 index 0000000..0bcd680 --- /dev/null +++ b/geocoding_platform_interface/lib/src/models/region.dart @@ -0,0 +1,126 @@ +import 'package:flutter/foundation.dart'; + +/// Contains information about a geographical region. +@immutable +class Region { + /// The latitude of the region's south border + final double southLatitude; + + /// The latitude of the region's north border + final double northLatitude; + + /// The longitude of the region's west border + final double westLongitude; + + /// The longitude of the region's east border + final double eastLongitude; + + static double _normalizeLatitude(double latitude) { + if (latitude < -90) { + return -90; + } + if (latitude > 90) { + return 90; + } + return latitude; + } + + static double _normalizeLongitude(double longitude) { + if (longitude >= -180 && longitude <= 180) { + return longitude; + } + return ((longitude + 180) % 360) - 180; + } + + /// Constructs a new region from: + /// - [southLatitude] The latitude of the region's south border + /// - [northLatitude] The latitude of the region's north border + /// - [westLongitude] The longitude of the region's west border + /// - [eastLongitude] The longitude of the region's east border + Region({ + required double southLatitude, + required double northLatitude, + required double westLongitude, + required double eastLongitude, + }) : southLatitude = _normalizeLatitude(southLatitude), + northLatitude = _normalizeLatitude(northLatitude), + westLongitude = _normalizeLongitude(westLongitude), + eastLongitude = _normalizeLongitude(eastLongitude); + + @override + bool operator ==(dynamic o) => + o is Region && + o.southLatitude == southLatitude && + o.northLatitude == northLatitude && + o.westLongitude == westLongitude && + o.eastLongitude == eastLongitude; + + @override + int get hashCode => southLatitude.hashCode ^ + northLatitude.hashCode ^ + westLongitude.hashCode ^ + eastLongitude.hashCode; + + /// Converts a list of [Map] instances to a list of [Location] instances. + static List fromMaps(dynamic message) { + if (message == null) { + throw ArgumentError('The parameter \'message\' should not be null.'); + } + + final List list = message.map(fromMap).toList(); + return list; + } + + /// Converts the supplied [Map] to an instance of the [Location] class. + static Region fromMap(dynamic message) { + if (message == null) { + throw ArgumentError('The parameter \'message\' should not be null.'); + } + + final Map locationMap = message; + + final double? southLatitude = locationMap['southLatitude']; + final double? northLatitude = locationMap['northLatitude']; + final double? westLongitude = locationMap['westLongitude']; + final double? eastLongitude = locationMap['eastLongitude']; + + if (southLatitude == null || + northLatitude == null || + westLongitude == null || + eastLongitude == null + ) { + throw ArgumentError('The parameters' + ' southLatitude' + ' and northLatitude' + ' and westLongitude' + ' and eastLongitude' + ' should not be null.'); + } + + return Region( + southLatitude: southLatitude, + northLatitude: northLatitude, + westLongitude: westLongitude, + eastLongitude: eastLongitude, + ); + } + + /// Converts the [Location] instance into a [Map] instance that can be + /// serialized to JSON. + Map toJson() => { + 'southLatitude': southLatitude, + 'northLatitude': northLatitude, + 'westLongitude': westLongitude, + 'eastLongitude': eastLongitude, + }; + + @override + String toString() { + return '{ ' + 'southLatitude: $southLatitude, ' + 'northLatitude: $northLatitude, ' + 'westLongitude: $westLongitude, ' + 'eastLongitude: $eastLongitude ' + '}'; + } +} diff --git a/geocoding_platform_interface/pubspec.yaml b/geocoding_platform_interface/pubspec.yaml index 1ad1d0b..43a2050 100644 --- a/geocoding_platform_interface/pubspec.yaml +++ b/geocoding_platform_interface/pubspec.yaml @@ -5,6 +5,8 @@ homepage: https://github.com/baseflow/flutter-geocoding/tree/master/geocoding_pl # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes version: 2.0.1 +publish_to: 'none' + dependencies: flutter: sdk: flutter diff --git a/geocoding_platform_interface/test/src/implementations/method_channel_geocoding_test.dart b/geocoding_platform_interface/test/src/implementations/method_channel_geocoding_test.dart index a7abedc..0c8c8c3 100644 --- a/geocoding_platform_interface/test/src/implementations/method_channel_geocoding_test.dart +++ b/geocoding_platform_interface/test/src/implementations/method_channel_geocoding_test.dart @@ -1,13 +1,14 @@ import 'package:flutter/services.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:geocoding_platform_interface/geocoding_platform_interface.dart'; -import 'package:geocoding_platform_interface/src/errors/no_result_found_exception.dart'; import 'package:geocoding_platform_interface/src/implementations/method_channel_geocoding.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); final _mockLocation = Location( + title: '', + description: '', latitude: 52.2165157, longitude: 6.9437819, timestamp: DateTime.fromMillisecondsSinceEpoch(0).toUtc(), diff --git a/geocoding_platform_interface/test/src/models/location_test.dart b/geocoding_platform_interface/test/src/models/location_test.dart index cc8d975..03be6af 100644 --- a/geocoding_platform_interface/test/src/models/location_test.dart +++ b/geocoding_platform_interface/test/src/models/location_test.dart @@ -7,10 +7,14 @@ void main() { () { // Arrange final firstLocation = Location( + title: '', + description: '', latitude: 0, longitude: 0, timestamp: DateTime.fromMillisecondsSinceEpoch((0))); final secondLocation = Location( + title: '', + description: '', latitude: 0, longitude: 0, timestamp: DateTime.fromMillisecondsSinceEpoch((0))); @@ -26,11 +30,15 @@ void main() { () { // Arrange final firstLocation = Location( + title: '', + description: '', latitude: 0, longitude: 0, timestamp: DateTime.fromMillisecondsSinceEpoch(0), ); final secondLocation = Location( + title: '', + description: '', latitude: 1, longitude: 0, timestamp: DateTime.fromMillisecondsSinceEpoch(0), @@ -47,11 +55,15 @@ void main() { () { // Arrange final firstLocation = Location( + title: '', + description: '', latitude: 0, longitude: 0, timestamp: DateTime.fromMillisecondsSinceEpoch(0), ); final secondLocation = Location( + title: '', + description: '', latitude: 0, longitude: 1, timestamp: DateTime.fromMillisecondsSinceEpoch(0), @@ -68,11 +80,15 @@ void main() { () { // Arrange final firstLocation = Location( + title: '', + description: '', latitude: 0, longitude: 0, timestamp: DateTime.fromMillisecondsSinceEpoch(0), ); final secondLocation = Location( + title: '', + description: '', latitude: 0, longitude: 0, timestamp: DateTime.fromMillisecondsSinceEpoch(1), @@ -105,6 +121,8 @@ void main() { group('toString tests:', () { test('toString should list the contents of all properties', () { final mockLocation = Location( + title: '', + description: '', latitude: 52.2165157, longitude: 6.9437819, timestamp: DateTime.fromMillisecondsSinceEpoch(0).toUtc(), From 493cdbfb12c50d5f4b8c013e14578c087ea450dc Mon Sep 17 00:00:00 2001 From: androidseb Date: Sat, 7 Jun 2025 11:40:44 +0200 Subject: [PATCH 2/9] Fixed all warnings and errors --- geocoding/pubspec.yaml | 6 ++++-- geocoding_android/lib/geocoding_android.dart | 5 +++-- geocoding_android/pubspec.yaml | 5 ++++- geocoding_android/test/geocoding_test.dart | 2 ++ geocoding_ios/lib/geocoding_ios.dart | 5 ++++- geocoding_ios/pubspec.yaml | 5 ++++- geocoding_ios/test/geocoding_test.dart | 2 ++ .../lib/src/models/region.dart | 12 ++++++------ 8 files changed, 29 insertions(+), 13 deletions(-) diff --git a/geocoding/pubspec.yaml b/geocoding/pubspec.yaml index f69a867..baf4cb0 100644 --- a/geocoding/pubspec.yaml +++ b/geocoding/pubspec.yaml @@ -16,8 +16,10 @@ dependencies: geocoding_platform_interface: path: ../geocoding_platform_interface - geocoding_android: ^4.0.0 - geocoding_ios: ^3.0.0 + geocoding_android: + path: ../geocoding_android + geocoding_ios: + path: ../geocoding_ios dev_dependencies: flutter_test: diff --git a/geocoding_android/lib/geocoding_android.dart b/geocoding_android/lib/geocoding_android.dart index 2c2c9a9..f765185 100644 --- a/geocoding_android/lib/geocoding_android.dart +++ b/geocoding_android/lib/geocoding_android.dart @@ -25,8 +25,9 @@ class GeocodingAndroid extends GeocodingPlatform { @override Future> locationFromAddress( - String address, - ) async { + String address, { + Region? targetRegion, + }) async { final parameters = { 'address': address, }; diff --git a/geocoding_android/pubspec.yaml b/geocoding_android/pubspec.yaml index 2ee6895..2ba9172 100644 --- a/geocoding_android/pubspec.yaml +++ b/geocoding_android/pubspec.yaml @@ -8,11 +8,14 @@ environment: sdk: ">=3.3.0 <4.0.0" flutter: ">=3.0.0" +publish_to: 'none' + dependencies: flutter: sdk: flutter - geocoding_platform_interface: ^3.2.0 + geocoding_platform_interface: + path: ../geocoding_platform_interface dev_dependencies: flutter_test: diff --git a/geocoding_android/test/geocoding_test.dart b/geocoding_android/test/geocoding_test.dart index c4e16db..355e1cf 100644 --- a/geocoding_android/test/geocoding_test.dart +++ b/geocoding_android/test/geocoding_test.dart @@ -4,6 +4,8 @@ import 'package:geocoding_android/geocoding_android.dart'; import 'package:geocoding_platform_interface/geocoding_platform_interface.dart'; final mockLocation = Location( + title: '', + description: '', latitude: 52.2165157, longitude: 6.9437819, timestamp: DateTime.fromMillisecondsSinceEpoch(0).toUtc(), diff --git a/geocoding_ios/lib/geocoding_ios.dart b/geocoding_ios/lib/geocoding_ios.dart index 234dbb6..427c24b 100644 --- a/geocoding_ios/lib/geocoding_ios.dart +++ b/geocoding_ios/lib/geocoding_ios.dart @@ -22,7 +22,10 @@ class GeocodingIOS extends GeocodingPlatform { } @override - Future> locationFromAddress(String address) async { + Future> locationFromAddress( + String address, { + Region? targetRegion, + }) async { final parameters = { 'address': address, }; diff --git a/geocoding_ios/pubspec.yaml b/geocoding_ios/pubspec.yaml index 0ced92a..0d910f0 100644 --- a/geocoding_ios/pubspec.yaml +++ b/geocoding_ios/pubspec.yaml @@ -8,11 +8,14 @@ environment: sdk: ">=3.3.0 <4.0.0" flutter: ">=3.0.0" +publish_to: 'none' + dependencies: flutter: sdk: flutter - geocoding_platform_interface: ^3.2.0 + geocoding_platform_interface: + path: ../geocoding_platform_interface dev_dependencies: flutter_test: diff --git a/geocoding_ios/test/geocoding_test.dart b/geocoding_ios/test/geocoding_test.dart index b87799a..4abddd1 100644 --- a/geocoding_ios/test/geocoding_test.dart +++ b/geocoding_ios/test/geocoding_test.dart @@ -4,6 +4,8 @@ import 'package:geocoding_ios/geocoding_ios.dart'; import 'package:geocoding_platform_interface/geocoding_platform_interface.dart'; final mockLocation = Location( + title: '', + description: '', latitude: 52.2165157, longitude: 6.9437819, timestamp: DateTime.fromMillisecondsSinceEpoch(0).toUtc(), diff --git a/geocoding_platform_interface/lib/src/models/region.dart b/geocoding_platform_interface/lib/src/models/region.dart index 0bcd680..7e2ff16 100644 --- a/geocoding_platform_interface/lib/src/models/region.dart +++ b/geocoding_platform_interface/lib/src/models/region.dart @@ -48,12 +48,12 @@ class Region { eastLongitude = _normalizeLongitude(eastLongitude); @override - bool operator ==(dynamic o) => - o is Region && - o.southLatitude == southLatitude && - o.northLatitude == northLatitude && - o.westLongitude == westLongitude && - o.eastLongitude == eastLongitude; + bool operator ==(Object other) => + other is Region && + other.southLatitude == southLatitude && + other.northLatitude == northLatitude && + other.westLongitude == westLongitude && + other.eastLongitude == eastLongitude; @override int get hashCode => southLatitude.hashCode ^ From e322f75fc55c60a0fda2ee09ab85e6730ee78b4d Mon Sep 17 00:00:00 2001 From: androidseb Date: Sat, 7 Jun 2025 12:39:11 +0200 Subject: [PATCH 3/9] Fixed Android implementation --- .../com/baseflow/geocoding/Geocoding.java | 64 ++++++++++++++++--- .../geocoding/MethodCallHandlerImpl.java | 28 ++++++-- 2 files changed, 80 insertions(+), 12 deletions(-) diff --git a/geocoding_android/android/src/main/java/com/baseflow/geocoding/Geocoding.java b/geocoding_android/android/src/main/java/com/baseflow/geocoding/Geocoding.java index aade3be..857f36f 100644 --- a/geocoding_android/android/src/main/java/com/baseflow/geocoding/Geocoding.java +++ b/geocoding_android/android/src/main/java/com/baseflow/geocoding/Geocoding.java @@ -52,14 +52,37 @@ boolean isPresent() { * @param callback the GeocodeListenerAdapter that listens for success or error * @return a list of Address objects. Returns null or empty list if no matches were found or there is no backend service available. */ - void placemarkFromAddress(String address, GeocodeListenerAdapter callback) { + void placemarkFromAddress( + String address, + Double lowerLeftLatitude, + Double lowerLeftLongitude, + Double upperRightLatitude, + Double upperRightLongitude, + GeocodeListenerAdapter callback + ) { final Geocoder geocoder = createGeocoder(androidContext, locale); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { - getAddressesWithGeocodeListener(geocoder, address, 5, callback); + getAddressesWithGeocodeListener( + geocoder, + address, + 5, + lowerLeftLatitude, + lowerLeftLongitude, + upperRightLatitude, + upperRightLongitude, + callback + ); } else { try { - List
addresses = deprecatedGetFromLocationName(geocoder, address); + List
addresses = deprecatedGetFromLocationName( + geocoder, + address, + lowerLeftLatitude, + lowerLeftLongitude, + upperRightLatitude, + upperRightLongitude + ); callback.onGeocode(addresses); } catch (IOException ex) { callback.onError(ex.getMessage()); @@ -68,13 +91,33 @@ void placemarkFromAddress(String address, GeocodeListenerAdapter callback) { } @SuppressWarnings("deprecation") - private List
deprecatedGetFromLocationName(Geocoder geocoder, String address) throws IOException { - return geocoder.getFromLocationName(address, 5); + private List
deprecatedGetFromLocationName( + Geocoder geocoder, + String address, + Double lowerLeftLatitude, + Double lowerLeftLongitude, + Double upperRightLatitude, + Double upperRightLongitude + ) throws IOException { + if (lowerLeftLatitude == null || lowerLeftLongitude == null || upperRightLatitude == null || upperRightLongitude == null) { + return geocoder.getFromLocationName(address, 5); + } else { + return geocoder.getFromLocationName(address, 5, lowerLeftLatitude, lowerLeftLongitude, upperRightLatitude, upperRightLongitude); + } } @RequiresApi(api = Build.VERSION_CODES.TIRAMISU) - private void getAddressesWithGeocodeListener(Geocoder geocoder, String address, int maxResults, GeocodeListenerAdapter callback) { - geocoder.getFromLocationName(address, maxResults, new Geocoder.GeocodeListener() { + private void getAddressesWithGeocodeListener( + Geocoder geocoder, + String address, + int maxResults, + Double lowerLeftLatitude, + Double lowerLeftLongitude, + Double upperRightLatitude, + Double upperRightLongitude, + GeocodeListenerAdapter callback + ) { + final Geocoder.GeocodeListener listener = new Geocoder.GeocodeListener() { @Override public void onGeocode(List
geocodedAddresses) { callback.onGeocode(geocodedAddresses); @@ -84,7 +127,12 @@ public void onGeocode(List
geocodedAddresses) { public void onError(@Nullable String errorMessage) { callback.onError(errorMessage); } - }); + }; + if (lowerLeftLatitude == null || lowerLeftLongitude == null || upperRightLatitude == null || upperRightLongitude == null) { + geocoder.getFromLocationName(address, maxResults, listener); + } else { + geocoder.getFromLocationName(address, maxResults, lowerLeftLatitude, lowerLeftLongitude, upperRightLatitude, upperRightLongitude, listener); + } } diff --git a/geocoding_android/android/src/main/java/com/baseflow/geocoding/MethodCallHandlerImpl.java b/geocoding_android/android/src/main/java/com/baseflow/geocoding/MethodCallHandlerImpl.java index 4bd808a..742a404 100644 --- a/geocoding_android/android/src/main/java/com/baseflow/geocoding/MethodCallHandlerImpl.java +++ b/geocoding_android/android/src/main/java/com/baseflow/geocoding/MethodCallHandlerImpl.java @@ -104,6 +104,16 @@ private void setLocaleIdentifier(MethodCall call, Result result) { result.success(true); } + // Parses a string as a double and returns the parsed value. + // If parsing is not possible or fails, returns null. + private static Double parseDoubleOrReturnNull(final String _string){ + try{ + return Double.parseDouble(_string); + }catch (Throwable t){ + return null; + } + } + private void onLocationFromAddress(MethodCall call, Result result) { final String address = call.argument("address"); @@ -114,8 +124,13 @@ private void onLocationFromAddress(MethodCall call, Result result) { null); } - geocoding.placemarkFromAddress(address, new GeocodeListenerAdapter() { - + geocoding.placemarkFromAddress( + address, + parseDoubleOrReturnNull(call.argument("targetRegionSLat")), // lowerLeftLatitude, + parseDoubleOrReturnNull(call.argument("targetRegionWLng")), // lowerLeftLongitude, + parseDoubleOrReturnNull(call.argument("targetRegionNLat")), // upperRightLatitude, + parseDoubleOrReturnNull(call.argument("targetRegionELng")), // upperRightLongitude + new GeocodeListenerAdapter() { @Override public void onGeocode(List
addresses) { if (addresses != null && addresses.size() > 0) { @@ -148,8 +163,13 @@ private void onPlacemarkFromAddress(final MethodCall call, final Result result) null); } - geocoding.placemarkFromAddress(address, new GeocodeListenerAdapter() { - + geocoding.placemarkFromAddress( + address, + parseDoubleOrReturnNull(call.argument("targetRegionSLat")), // lowerLeftLatitude, + parseDoubleOrReturnNull(call.argument("targetRegionWLng")), // lowerLeftLongitude, + parseDoubleOrReturnNull(call.argument("targetRegionNLat")), // upperRightLatitude, + parseDoubleOrReturnNull(call.argument("targetRegionELng")), // upperRightLongitude + new GeocodeListenerAdapter() { @Override public void onGeocode(List
addresses) { if (addresses != null && addresses.size() > 0) { From 2589e4b13d461aa7836aea9a7ffced2592a9c246 Mon Sep 17 00:00:00 2001 From: androidseb Date: Sat, 7 Jun 2025 14:12:35 +0200 Subject: [PATCH 4/9] Fixed iOS implementation --- geocoding_ios/ios/Classes/GeocodingHandler.m | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/geocoding_ios/ios/Classes/GeocodingHandler.m b/geocoding_ios/ios/Classes/GeocodingHandler.m index 3e12635..00b792c 100644 --- a/geocoding_ios/ios/Classes/GeocodingHandler.m +++ b/geocoding_ios/ios/Classes/GeocodingHandler.m @@ -23,6 +23,10 @@ - (id)init { - (void) geocodeFromAddress: (NSString *)address locale: (NSLocale *)locale + sLat: (CGFloat) sLat + wLng: (CGFloat) sLng + nLat: (CGFloat) nLat + eLng: (CGFloat) nLng success: (GeocodingSuccess)successHandler failure: (GeocodingFailure)failureHandler { @@ -30,9 +34,21 @@ - (void) geocodeFromAddress: (NSString *)address failureHandler(@"ARGUMENT_ERROR", @"Please supply a valid string containing the address to lookup"); return; } - + + CLRegion* region; + if (sLat == 0 || sLng == 0 || nLat == 0 || nLng == 0){ + region = nil; + }else{ + CLLocationCoordinate2D center = CLLocationCoordinate2DMake(sLat + (nLat-sLat) / 2, sLng + (nLng-sLng) / 2); + //Computing the radius based on lat delta, since 1 lat = 111 km no matter the location + float latDelta = nLat - sLat; + float radiusLat = (latDelta/2); + float radius = radiusLat * 111000; + region = [[CLCircularRegion alloc] initWithCenter:center radius:radius identifier:@"Search Radius"]; + } + [_geocoder geocodeAddressString:address - inRegion:nil + inRegion:region preferredLocale:locale completionHandler:^(NSArray< CLPlacemark *> *__nullable placemarks, NSError *__nullable error) { From 644fd411a8aebdbbd4620bccd2ad816087b11a05 Mon Sep 17 00:00:00 2001 From: androidseb Date: Sat, 7 Jun 2025 14:17:08 +0200 Subject: [PATCH 5/9] Reverted unneeded change to geocoding_plaform_interface/pubspec.yaml --- geocoding_platform_interface/pubspec.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/geocoding_platform_interface/pubspec.yaml b/geocoding_platform_interface/pubspec.yaml index 1948e8c..0805f12 100644 --- a/geocoding_platform_interface/pubspec.yaml +++ b/geocoding_platform_interface/pubspec.yaml @@ -9,8 +9,6 @@ environment: sdk: ">=3.3.0 <4.0.0" flutter: ">=3.0.0" -publish_to: 'none' - dependencies: flutter: sdk: flutter From 5ed982eb070cae3582b302fc9dcc9607c8eb1cb4 Mon Sep 17 00:00:00 2001 From: androidseb Date: Sat, 7 Jun 2025 14:25:35 +0200 Subject: [PATCH 6/9] Updated geocoding_platform_interface dependencies --- geocoding/pubspec.yaml | 5 ++++- geocoding_android/pubspec.yaml | 5 ++++- geocoding_ios/pubspec.yaml | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/geocoding/pubspec.yaml b/geocoding/pubspec.yaml index baf4cb0..3674010 100644 --- a/geocoding/pubspec.yaml +++ b/geocoding/pubspec.yaml @@ -15,7 +15,10 @@ dependencies: sdk: flutter geocoding_platform_interface: - path: ../geocoding_platform_interface + git: + url: https://github.com/androidseb/flutter-geocoding + ref: 644fd411a8aebdbbd4620bccd2ad816087b11a05 + path: geocoding_platform_interface geocoding_android: path: ../geocoding_android geocoding_ios: diff --git a/geocoding_android/pubspec.yaml b/geocoding_android/pubspec.yaml index 2ba9172..f77a4f5 100644 --- a/geocoding_android/pubspec.yaml +++ b/geocoding_android/pubspec.yaml @@ -15,7 +15,10 @@ dependencies: sdk: flutter geocoding_platform_interface: - path: ../geocoding_platform_interface + git: + url: https://github.com/androidseb/flutter-geocoding + ref: 644fd411a8aebdbbd4620bccd2ad816087b11a05 + path: geocoding_platform_interface dev_dependencies: flutter_test: diff --git a/geocoding_ios/pubspec.yaml b/geocoding_ios/pubspec.yaml index 0d910f0..b334a61 100644 --- a/geocoding_ios/pubspec.yaml +++ b/geocoding_ios/pubspec.yaml @@ -15,7 +15,10 @@ dependencies: sdk: flutter geocoding_platform_interface: - path: ../geocoding_platform_interface + git: + url: https://github.com/androidseb/flutter-geocoding + ref: 644fd411a8aebdbbd4620bccd2ad816087b11a05 + path: geocoding_platform_interface dev_dependencies: flutter_test: From 3bcfae2fc985587fbf577116ca0998a5ed9de9a3 Mon Sep 17 00:00:00 2001 From: androidseb Date: Sat, 7 Jun 2025 14:28:03 +0200 Subject: [PATCH 7/9] Updated remaining git dependencies --- geocoding/pubspec.yaml | 12 +++++++++--- geocoding_android/pubspec.yaml | 2 +- geocoding_ios/pubspec.yaml | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/geocoding/pubspec.yaml b/geocoding/pubspec.yaml index 3674010..6d1d7ac 100644 --- a/geocoding/pubspec.yaml +++ b/geocoding/pubspec.yaml @@ -17,12 +17,18 @@ dependencies: geocoding_platform_interface: git: url: https://github.com/androidseb/flutter-geocoding - ref: 644fd411a8aebdbbd4620bccd2ad816087b11a05 + ref: 5ed982eb070cae3582b302fc9dcc9607c8eb1cb4 path: geocoding_platform_interface geocoding_android: - path: ../geocoding_android + git: + url: https://github.com/androidseb/flutter-geocoding + ref: 5ed982eb070cae3582b302fc9dcc9607c8eb1cb4 + path: geocoding_android geocoding_ios: - path: ../geocoding_ios + git: + url: https://github.com/androidseb/flutter-geocoding + ref: 5ed982eb070cae3582b302fc9dcc9607c8eb1cb4 + path: geocoding_ios dev_dependencies: flutter_test: diff --git a/geocoding_android/pubspec.yaml b/geocoding_android/pubspec.yaml index f77a4f5..c954eea 100644 --- a/geocoding_android/pubspec.yaml +++ b/geocoding_android/pubspec.yaml @@ -17,7 +17,7 @@ dependencies: geocoding_platform_interface: git: url: https://github.com/androidseb/flutter-geocoding - ref: 644fd411a8aebdbbd4620bccd2ad816087b11a05 + ref: 5ed982eb070cae3582b302fc9dcc9607c8eb1cb4 path: geocoding_platform_interface dev_dependencies: diff --git a/geocoding_ios/pubspec.yaml b/geocoding_ios/pubspec.yaml index b334a61..72a8cae 100644 --- a/geocoding_ios/pubspec.yaml +++ b/geocoding_ios/pubspec.yaml @@ -17,7 +17,7 @@ dependencies: geocoding_platform_interface: git: url: https://github.com/androidseb/flutter-geocoding - ref: 644fd411a8aebdbbd4620bccd2ad816087b11a05 + ref: 5ed982eb070cae3582b302fc9dcc9607c8eb1cb4 path: geocoding_platform_interface dev_dependencies: From e8bcacb788483e26e79da4c4d434bedf13e162e1 Mon Sep 17 00:00:00 2001 From: androidseb Date: Sat, 7 Jun 2025 14:41:11 +0200 Subject: [PATCH 8/9] Made some changes to make the code changes PR-friendly --- geocoding/CHANGELOG.md | 5 +++++ geocoding/pubspec.yaml | 22 ++++------------------ geocoding_android/pubspec.yaml | 10 ++-------- geocoding_ios/pubspec.yaml | 10 ++-------- geocoding_platform_interface/pubspec.yaml | 2 +- 5 files changed, 14 insertions(+), 35 deletions(-) diff --git a/geocoding/CHANGELOG.md b/geocoding/CHANGELOG.md index e0925c8..b9a19c0 100644 --- a/geocoding/CHANGELOG.md +++ b/geocoding/CHANGELOG.md @@ -1,3 +1,8 @@ +## 4.1.0 + +* Added the ability to refine address search by geographic location +* The search results' Location object now have new `title` and `description` fields + ## 4.0.0 * **BREAKING CHANGES** Please update to Flutter 3.29+ before updating to this version diff --git a/geocoding/pubspec.yaml b/geocoding/pubspec.yaml index 6d1d7ac..c28efca 100644 --- a/geocoding/pubspec.yaml +++ b/geocoding/pubspec.yaml @@ -1,11 +1,9 @@ name: geocoding description: A Flutter Geocoding plugin which provides easy geocoding and reverse-geocoding features. -version: 4.0.0 +version: 4.1.0 repository: https://github.com/baseflow/flutter-geocoding/tree/main/geocoding issue_tracker: https://github.com/Baseflow/flutter-geocoding/issues -publish_to: 'none' - environment: sdk: ">=3.3.0 <4.0.0" flutter: ">=3.0.0" @@ -14,21 +12,9 @@ dependencies: flutter: sdk: flutter - geocoding_platform_interface: - git: - url: https://github.com/androidseb/flutter-geocoding - ref: 5ed982eb070cae3582b302fc9dcc9607c8eb1cb4 - path: geocoding_platform_interface - geocoding_android: - git: - url: https://github.com/androidseb/flutter-geocoding - ref: 5ed982eb070cae3582b302fc9dcc9607c8eb1cb4 - path: geocoding_android - geocoding_ios: - git: - url: https://github.com/androidseb/flutter-geocoding - ref: 5ed982eb070cae3582b302fc9dcc9607c8eb1cb4 - path: geocoding_ios + geocoding_platform_interface: ^4.0.0 + geocoding_android: ^4.1.0 + geocoding_ios: ^3.1.0 dev_dependencies: flutter_test: diff --git a/geocoding_android/pubspec.yaml b/geocoding_android/pubspec.yaml index c954eea..c2fa25d 100644 --- a/geocoding_android/pubspec.yaml +++ b/geocoding_android/pubspec.yaml @@ -1,6 +1,6 @@ name: geocoding_android description: A Flutter Geocoding plugin which provides easy geocoding and reverse-geocoding features. -version: 4.0.1 +version: 4.1.0 repository: https://github.com/baseflow/flutter-geocoding/tree/main/geocoding_android issue_tracker: https://github.com/Baseflow/flutter-geocoding/issues @@ -8,17 +8,11 @@ environment: sdk: ">=3.3.0 <4.0.0" flutter: ">=3.0.0" -publish_to: 'none' - dependencies: flutter: sdk: flutter - geocoding_platform_interface: - git: - url: https://github.com/androidseb/flutter-geocoding - ref: 5ed982eb070cae3582b302fc9dcc9607c8eb1cb4 - path: geocoding_platform_interface + geocoding_platform_interface: ^4.0.0 dev_dependencies: flutter_test: diff --git a/geocoding_ios/pubspec.yaml b/geocoding_ios/pubspec.yaml index 72a8cae..c15fff7 100644 --- a/geocoding_ios/pubspec.yaml +++ b/geocoding_ios/pubspec.yaml @@ -1,6 +1,6 @@ name: geocoding_ios description: A Flutter Geocoding plugin which provides easy geocoding and reverse-geocoding features. -version: 3.0.2 +version: 3.1.0 repository: https://github.com/baseflow/flutter-geocoding/tree/main/geocoding_ios issue_tracker: https://github.com/Baseflow/flutter-geocoding/issues @@ -8,17 +8,11 @@ environment: sdk: ">=3.3.0 <4.0.0" flutter: ">=3.0.0" -publish_to: 'none' - dependencies: flutter: sdk: flutter - geocoding_platform_interface: - git: - url: https://github.com/androidseb/flutter-geocoding - ref: 5ed982eb070cae3582b302fc9dcc9607c8eb1cb4 - path: geocoding_platform_interface + geocoding_platform_interface: ^4.0.0 dev_dependencies: flutter_test: diff --git a/geocoding_platform_interface/pubspec.yaml b/geocoding_platform_interface/pubspec.yaml index 0805f12..11ca9b3 100644 --- a/geocoding_platform_interface/pubspec.yaml +++ b/geocoding_platform_interface/pubspec.yaml @@ -3,7 +3,7 @@ description: A common platform interface for the geocoding plugin. homepage: https://github.com/baseflow/flutter-geocoding/tree/main/geocoding_platform_interface # NOTE: We strongly prefer non-breaking changes, even at the expense of a # less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes -version: 3.2.1 +version: 4.0.0 environment: sdk: ">=3.3.0 <4.0.0" From e6b42aaaddfba78a5647ed8cc391e48defc7f983 Mon Sep 17 00:00:00 2001 From: androidseb Date: Sat, 7 Jun 2025 15:05:55 +0200 Subject: [PATCH 9/9] Fixed dependencies issues --- geocoding/pubspec.yaml | 15 +++------------ geocoding_android/pubspec.yaml | 5 +---- geocoding_ios/pubspec.yaml | 5 +---- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/geocoding/pubspec.yaml b/geocoding/pubspec.yaml index 6d1d7ac..a5e8958 100644 --- a/geocoding/pubspec.yaml +++ b/geocoding/pubspec.yaml @@ -15,20 +15,11 @@ dependencies: sdk: flutter geocoding_platform_interface: - git: - url: https://github.com/androidseb/flutter-geocoding - ref: 5ed982eb070cae3582b302fc9dcc9607c8eb1cb4 - path: geocoding_platform_interface + path: ../geocoding_platform_interface geocoding_android: - git: - url: https://github.com/androidseb/flutter-geocoding - ref: 5ed982eb070cae3582b302fc9dcc9607c8eb1cb4 - path: geocoding_android + path: ../geocoding_android geocoding_ios: - git: - url: https://github.com/androidseb/flutter-geocoding - ref: 5ed982eb070cae3582b302fc9dcc9607c8eb1cb4 - path: geocoding_ios + path: ../geocoding_ios dev_dependencies: flutter_test: diff --git a/geocoding_android/pubspec.yaml b/geocoding_android/pubspec.yaml index c954eea..2ba9172 100644 --- a/geocoding_android/pubspec.yaml +++ b/geocoding_android/pubspec.yaml @@ -15,10 +15,7 @@ dependencies: sdk: flutter geocoding_platform_interface: - git: - url: https://github.com/androidseb/flutter-geocoding - ref: 5ed982eb070cae3582b302fc9dcc9607c8eb1cb4 - path: geocoding_platform_interface + path: ../geocoding_platform_interface dev_dependencies: flutter_test: diff --git a/geocoding_ios/pubspec.yaml b/geocoding_ios/pubspec.yaml index 72a8cae..0d910f0 100644 --- a/geocoding_ios/pubspec.yaml +++ b/geocoding_ios/pubspec.yaml @@ -15,10 +15,7 @@ dependencies: sdk: flutter geocoding_platform_interface: - git: - url: https://github.com/androidseb/flutter-geocoding - ref: 5ed982eb070cae3582b302fc9dcc9607c8eb1cb4 - path: geocoding_platform_interface + path: ../geocoding_platform_interface dev_dependencies: flutter_test: