From 0e21f8c243e993f07b4f26de81b348613e7a86c7 Mon Sep 17 00:00:00 2001 From: Rick van Dijk Date: Mon, 30 Nov 2026 16:33:24 +0800 Subject: [PATCH 1/3] [geocoding]: Raise minimum SDK to Dart 3.12 and Flutter 3.44 Linear: FPL-58 Co-Authored-By: Claude Opus 5.5 --- geocoding/CHANGELOG.md | 4 ++++ geocoding/example/pubspec.yaml | 4 ++-- geocoding/pubspec.yaml | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/geocoding/CHANGELOG.md b/geocoding/CHANGELOG.md index 4bf5ea1..89816a8 100644 --- a/geocoding/CHANGELOG.md +++ b/geocoding/CHANGELOG.md @@ -1,3 +1,7 @@ +## 5.1.0 + +- Raises the minimum SDK to Dart 3.12 and Flutter 3.44. + ## 5.0.1 - Fixes the `locale` parameter of the `Geocoding` constructor being ignored (#324). diff --git a/geocoding/example/pubspec.yaml b/geocoding/example/pubspec.yaml index 209ae79..dcd7f0a 100644 --- a/geocoding/example/pubspec.yaml +++ b/geocoding/example/pubspec.yaml @@ -6,8 +6,8 @@ description: Demonstrates how to use the geocoding plugin. publish_to: 'none' # Remove this line if you wish to publish to pub.dev environment: - sdk: ">=3.3.0 <4.0.0" - flutter: ">=3.0.0" + sdk: ^3.12.0 + flutter: ">=3.44.0" dependencies: baseflow_plugin_template: ^2.1.2 diff --git a/geocoding/pubspec.yaml b/geocoding/pubspec.yaml index bcd9793..b00184f 100644 --- a/geocoding/pubspec.yaml +++ b/geocoding/pubspec.yaml @@ -1,12 +1,12 @@ name: geocoding description: A Flutter Geocoding plugin which provides easy geocoding and reverse-geocoding features. -version: 5.0.1 +version: 5.1.0 repository: https://github.com/baseflow/flutter-geocoding/tree/main/geocoding issue_tracker: https://github.com/Baseflow/flutter-geocoding/issues environment: - sdk: ">=3.3.0 <4.0.0" - flutter: ">=3.0.0" + sdk: ^3.12.0 + flutter: ">=3.44.0" dependencies: flutter: From 3cc40ca35fe5f1084a75968145f5631303fb22c0 Mon Sep 17 00:00:00 2001 From: Rick van Dijk Date: Mon, 30 Nov 2026 16:36:04 +0800 Subject: [PATCH 2/3] [geocoding]: Apply dart format Co-Authored-By: Claude Opus 5.5 --- geocoding/example/lib/main.dart | 178 +++++++++++++---------------- geocoding/lib/geocoding.dart | 47 ++++---- geocoding/test/geocoding_test.dart | 28 ++--- 3 files changed, 117 insertions(+), 136 deletions(-) diff --git a/geocoding/example/lib/main.dart b/geocoding/example/lib/main.dart index 1099632..7e17c7f 100644 --- a/geocoding/example/lib/main.dart +++ b/geocoding/example/lib/main.dart @@ -40,9 +40,7 @@ class _GeocodeWidgetState extends State { crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ - const Padding( - padding: EdgeInsets.only(top: 32), - ), + const Padding(padding: EdgeInsets.only(top: 32)), Row( children: [ Expanded( @@ -50,127 +48,112 @@ class _GeocodeWidgetState extends State { autocorrect: false, controller: _latitudeController, style: Theme.of(context).textTheme.bodyMedium, - decoration: const InputDecoration( - hintText: 'Latitude', - ), + decoration: const InputDecoration(hintText: 'Latitude'), keyboardType: TextInputType.number, ), ), - const SizedBox( - width: 20, - ), + const SizedBox(width: 20), Expanded( child: TextField( autocorrect: false, controller: _longitudeController, style: Theme.of(context).textTheme.bodyMedium, - decoration: const InputDecoration( - hintText: 'Longitude', - ), + decoration: const InputDecoration(hintText: 'Longitude'), keyboardType: TextInputType.number, ), ), ], ), - const Padding( - padding: EdgeInsets.only(top: 8), - ), + const Padding(padding: EdgeInsets.only(top: 8)), Center( child: ElevatedButton( - child: const Text('Look up address'), - onPressed: () { - final latitude = double.parse(_latitudeController.text); - final longitude = double.parse(_longitudeController.text); + child: const Text('Look up address'), + onPressed: () { + final latitude = double.parse(_latitudeController.text); + final longitude = double.parse(_longitudeController.text); - _geocoding - .placemarkFromCoordinates( - latitude, - longitude, - locale: _locale, - ) - .then((placemarks) { - var output = 'No results found.'; - if (placemarks.isNotEmpty) { - output = placemarks[0].toDisplayString(); - } + _geocoding + .placemarkFromCoordinates( + latitude, + longitude, + locale: _locale, + ) + .then((placemarks) { + var output = 'No results found.'; + if (placemarks.isNotEmpty) { + output = placemarks[0].toDisplayString(); + } - setState(() { - _output = output; + setState(() { + _output = output; + }); }); - }); - }), - ), - const Padding( - padding: EdgeInsets.only(top: 32), + }, + ), ), + const Padding(padding: EdgeInsets.only(top: 32)), TextField( autocorrect: false, controller: _addressController, style: Theme.of(context).textTheme.bodyMedium, - decoration: const InputDecoration( - hintText: 'Address', - ), + decoration: const InputDecoration(hintText: 'Address'), keyboardType: TextInputType.text, ), - const Padding( - padding: EdgeInsets.only(top: 8), - ), + const Padding(padding: EdgeInsets.only(top: 8)), Center( child: ElevatedButton( - child: const Text('Look up location'), - onPressed: () { - _geocoding - .locationFromAddress( - _addressController.text, - locale: _locale, - ) - .then((locations) { - var output = 'No results found.'; - if (locations.isNotEmpty) { - output = locations[0].toDisplayString(); - } - setState(() { - _output = output; + child: const Text('Look up location'), + onPressed: () { + _geocoding + .locationFromAddress( + _addressController.text, + locale: _locale, + ) + .then((locations) { + var output = 'No results found.'; + if (locations.isNotEmpty) { + output = locations[0].toDisplayString(); + } + setState(() { + _output = output; + }); }); - }); - }), - ), - const Padding( - padding: EdgeInsets.only(top: 8), + }, + ), ), + const Padding(padding: EdgeInsets.only(top: 8)), Center( child: ElevatedButton( - child: const Text('is Present'), - onPressed: () { - _geocoding.isPresent().then((isPresent) { - var output = isPresent ? 'Is present' : 'Is not present'; - setState(() { - _output = output; - }); + child: const Text('is Present'), + onPressed: () { + _geocoding.isPresent().then((isPresent) { + var output = isPresent ? 'Is present' : 'Is not present'; + setState(() { + _output = output; }); - }), - ), - const Padding( - padding: EdgeInsets.only(top: 8), + }); + }, + ), ), + const Padding(padding: EdgeInsets.only(top: 8)), Center( - child: ElevatedButton( - child: const Text('Set locale en_US'), - onPressed: () { - setState(() => _locale = Locale('en_US')); - })), - const Padding( - padding: EdgeInsets.only(top: 8), + child: ElevatedButton( + child: const Text('Set locale en_US'), + onPressed: () { + setState(() => _locale = Locale('en_US')); + }, + ), ), + const Padding(padding: EdgeInsets.only(top: 8)), Center( - child: ElevatedButton( - child: const Text('Set locale nl_NL'), - onPressed: () { - setState(() => _locale = Locale('nl_NL')); - })), - const Padding( - padding: EdgeInsets.only(top: 8), + child: ElevatedButton( + child: const Text('Set locale nl_NL'), + onPressed: () { + setState(() => _locale = Locale('nl_NL')); + }, + ), ), + const Padding(padding: EdgeInsets.only(top: 8)), Expanded( child: SingleChildScrollView( child: SizedBox( @@ -178,7 +161,7 @@ class _GeocodeWidgetState extends State { child: Text(_output), ), ), - ) + ), ], ), ); @@ -217,14 +200,15 @@ class _GeocodingExample extends StatelessWidget { @override Widget build(BuildContext context) { return BaseflowPluginExample( - pluginName: 'Geocoding', - githubURL: 'https://github.com/Baseflow/flutter-geocoding', - pubDevURL: 'https://pub.dev/packages/geocoding', - pages: [ - ExamplePage( - Icons.pin_drop, - (BuildContext context) => const GeocodeWidget(), - ), - ]); + pluginName: 'Geocoding', + githubURL: 'https://github.com/Baseflow/flutter-geocoding', + pubDevURL: 'https://pub.dev/packages/geocoding', + pages: [ + ExamplePage( + Icons.pin_drop, + (BuildContext context) => const GeocodeWidget(), + ), + ], + ); } } diff --git a/geocoding/lib/geocoding.dart b/geocoding/lib/geocoding.dart index ebf95dc..a23794a 100644 --- a/geocoding/lib/geocoding.dart +++ b/geocoding/lib/geocoding.dart @@ -1,4 +1,5 @@ import 'dart:async'; + import 'package:flutter/widgets.dart' as flt show Locale; import 'package:flutter/widgets.dart'; @@ -12,18 +13,20 @@ export 'package:geocoding_platform_interface/geocoding_platform_interface.dart'; class Geocoding { /// Constructs a [Geocoding] instance. Geocoding({Locale? locale}) - : this._fromPlatformCreationParams( - pi.GeocodingCreationParams(), - locale: locale, - ); + : this._fromPlatformCreationParams( + pi.GeocodingCreationParams(), + locale: locale, + ); /// Constructs a [Geocoding] instance from creation params for a specific /// platform. - Geocoding._fromPlatformCreationParams(pi.GeocodingCreationParams params, - {Locale? locale}) - : _locale = locale, - _geocoding = - pi.GeocodingPlatformFactory.instance!.createGeocoding(params); + Geocoding._fromPlatformCreationParams( + pi.GeocodingCreationParams params, { + Locale? locale, + }) : _locale = locale, + _geocoding = pi.GeocodingPlatformFactory.instance!.createGeocoding( + params, + ); final pi.Geocoding _geocoding; Locale? _locale; @@ -37,11 +40,7 @@ class Geocoding { Future> locationFromAddress( String address, { flt.Locale? locale, - }) => - _geocoding.locationFromAddress( - address, - locale: locale ?? _locale, - ); + }) => _geocoding.locationFromAddress(address, locale: locale ?? _locale); /// Returns a list of [Placemark] instances found for the supplied address. /// @@ -52,11 +51,7 @@ class Geocoding { Future> placemarkFromAddress( String address, { flt.Locale? locale, - }) => - _geocoding.placemarkFromAddress( - address, - locale: locale ?? _locale, - ); + }) => _geocoding.placemarkFromAddress(address, locale: locale ?? _locale); /// Returns a list of [Placemark] instances found for the supplied /// coordinates. @@ -71,12 +66,11 @@ class Geocoding { double latitude, double longitude, { flt.Locale? locale, - }) => - _geocoding.placemarkFromCoordinates( - latitude, - longitude, - locale: locale ?? _locale, - ); + }) => _geocoding.placemarkFromCoordinates( + latitude, + longitude, + locale: locale ?? _locale, + ); /// Returns true if there is a geocoder implementation present that may return results. /// If true, there is still no guarantee that any individual geocoding attempt will succeed. @@ -92,7 +86,8 @@ class Geocoding { /// current active locale of the device will be used. The localeIdentifier should /// be formatted using the syntax: languageCode_countryCode (eg. en_US or nl_NL). @Deprecated( - 'Use the optional constructor parameter instead, or pass in a locale with any of the methods.') + 'Use the optional constructor parameter instead, or pass in a locale with any of the methods.', + ) void setLocaleIdentifier(String localeIdentifier) => _locale = Locale(localeIdentifier); } diff --git a/geocoding/test/geocoding_test.dart b/geocoding/test/geocoding_test.dart index 198726a..18eead8 100644 --- a/geocoding/test/geocoding_test.dart +++ b/geocoding/test/geocoding_test.dart @@ -11,17 +11,18 @@ final mockLocation = Location( ); const mockPlacemark = Placemark( - administrativeArea: 'Overijssel', - country: 'Netherlands', - isoCountryCode: 'NL', - locality: 'Enschede', - name: 'Gronausestraat', - postalCode: '', - street: 'Gronausestraat 710', - subAdministrativeArea: 'Enschede', - subLocality: 'Enschmarke', - subThoroughfare: '', - thoroughfare: 'Gronausestraat'); + administrativeArea: 'Overijssel', + country: 'Netherlands', + isoCountryCode: 'NL', + locality: 'Enschede', + name: 'Gronausestraat', + postalCode: '', + street: 'Gronausestraat 710', + subAdministrativeArea: 'Enschede', + subLocality: 'Enschmarke', + subThoroughfare: '', + thoroughfare: 'Gronausestraat', +); void main() { group('Geocoding', () { @@ -29,8 +30,9 @@ void main() { setUp(() { platform = MockGeocodingPlatform(const GeocodingCreationParams()); - GeocodingPlatformFactory.instance = - MockGeocodingPlatformFactory(platform); + GeocodingPlatformFactory.instance = MockGeocodingPlatformFactory( + platform, + ); }); test('locationFromAddress', () async { From d860aa0cac85605930bc23ba7b2a8e0dda5fed8b Mon Sep 17 00:00:00 2001 From: Rick van Dijk Date: Mon, 30 Nov 2026 16:38:04 +0800 Subject: [PATCH 3/3] [geocoding]: Use a private named parameter for the locale Dart 3.12 allows initializing a private field from a named parameter, so prefer_initializing_formals now flags the explicit _locale assignment. Co-Authored-By: Claude Opus 5.5 --- geocoding/lib/geocoding.dart | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/geocoding/lib/geocoding.dart b/geocoding/lib/geocoding.dart index a23794a..7254aba 100644 --- a/geocoding/lib/geocoding.dart +++ b/geocoding/lib/geocoding.dart @@ -22,9 +22,8 @@ class Geocoding { /// platform. Geocoding._fromPlatformCreationParams( pi.GeocodingCreationParams params, { - Locale? locale, - }) : _locale = locale, - _geocoding = pi.GeocodingPlatformFactory.instance!.createGeocoding( + this._locale, + }) : _geocoding = pi.GeocodingPlatformFactory.instance!.createGeocoding( params, );