Upgrading geolocator 6 to 7
Breaking6.2.1 → 7.7.1Breaking4Platform1New5Changed4Fixed4Other8
BreakingUpgrade verdict
4 breaking changes and a platform requirement change.
In plain terms
- On Android, a permission check will no longer report that permission was permanently denied.
- The old timeInterval option for position streams is gone; use the newer interval settings instead.
- Old top-level helper functions that were deprecated are no longer available.
- The package now fully supports Dart null safety, so code that uses it may need null-safe types.
Must act Top 4 of 5 that need code or config changes
Dart SDK requirement changed in 7.0.2: >=2.7.0 <3.0.0 → >=2.12.0 <3.0.0.
Flutter requirement changed in 7.0.0-nullsafety.6: >=1.10.0 → >=1.20.0.
Adds geolocator_android ^2.0.0, geolocator_apple ^1.2.0.
Moves geolocator_platform_interface ^1.0.8 → ^2.3.4, geolocator_web ^1.0.1 → ^2.0.1. Your build may pick other versions.
What you must change
Breaking4
Checking permissions on Android can no longer result in LocationPermissions.deniedForever.
LocationPermissions.deniedForeverRemoves the deprecated timeInterval parameter from the getPositionStream method.
timeIntervalgetPositionStreamRemoves deprecated global methods.
Stable release of the null safety migration.
Platform1
Requires setting compileSdkVersion to 31 in android/app/build.gradle when updating to 7.7.0.
compileSdkVersionAPI changes
Generated by DepDelta from published Dart source. Not mixed with prose notes.
- removed:
function bearingBetween( double startLatitude, double startLongitude, double endLatitude, double endLongitude, ): double - removed:
function checkPermission(): Future<LocationPermission> - removed:
function distanceBetween( double startLatitude, double startLongitude, double endLatitude, double endLongitude, ): double - removed:
function getCurrentPosition({ LocationAccuracy desiredAccuracy = …, bool forceAndroidLocationManager = …, Duration timeLimit, }): Future<Position> - removed:
function getLastKnownPosition( {bool forceAndroidLocationManager = …}): Future<Position> - removed:
function getPositionStream({ LocationAccuracy desiredAccuracy = …, int distanceFilter = …, bool forceAndroidLocationManager = …, int timeInterval = …, Duration timeLimit, }): Stream<Position> - removed:
function isLocationServiceEnabled(): Future<bool> - removed:
function openAppSettings(): Future<bool> - removed:
function openLocationSettings(): Future<bool> - removed:
function requestPermission(): Future<LocationPermission> - changed:
static method Geolocator.getCurrentPosition({ LocationAccuracy desiredAccuracy = …, bool forceAndroidLocationManager = …, Duration timeLimit, }): Future<Position> → static method Geolocator.getCurrentPosition({ LocationAccuracy desiredAccuracy = …, bool forceAndroidLocationManager = …, Duration? timeLimit, }): Future<Position> - changed:
static method Geolocator.getLastKnownPosition( {bool forceAndroidLocationManager = …}): Future<Position> → static method Geolocator.getLastKnownPosition( {bool forceAndroidLocationManager = …}): Future<Position?> - changed:
static method Geolocator.getPositionStream({ LocationAccuracy desiredAccuracy = …, int distanceFilter = …, bool forceAndroidLocationManager = …, @Deprecated('The timeInterval parameter has been deprecated, use the ' 'intervalDuration parameter instead') int timeInterval = …, Duration intervalDuration, Duration timeLimit, }): Stream<Position> → static method Geolocator.getPositionStream({ LocationAccuracy desiredAccuracy = …, int distanceFilter = …, bool forceAndroidLocationManager = …, Duration? intervalDuration, Duration? timeLimit, }): Stream<Position> - added:
static method Geolocator.getLocationAccuracy(): Future<LocationAccuracyStatus> - added:
static method Geolocator.getServiceStatusStream(): Stream<ServiceStatus> - added:
static method Geolocator.requestTemporaryFullAccuracy({ required String purposeKey, }): Future<LocationAccuracyStatus>