Skip to content

Upgrading geolocator 0.0 to 1

Breaking0.0.2 → 1.7.0Breaking5Deprecated1New9Changed5Fixed13Other4

BreakingUpgrade verdict

5 breaking changes.

  • The method for requesting the current location has a new name, so existing code must be updated.
  • The two methods that convert between addresses and coordinates have clearer names, so existing code must be updated.
  • On Android, permission requests can no longer overlap. Because of this, getting the location stream now returns a Future you must await.
  • Code that requests a stream of location updates must now pass a LocationOptions object rather than a LocationAccuracy value.
Top 4 of 6 that need code or config changes

Dart SDK requirement changed in 1.7.0: >=2.0.0-dev.28.0 <3.0.0 → >=2.0.0-dev.68.0 <3.0.0.

Adds permission_handler >=2.0.0 <3.0.0.

Breaking5
Renames getPosition to getCurrentPosition.
getPositiongetCurrentPosition
Renames toPlacemark and fromPlacemark to placemarkFromAddress and placemarkFromCoordinates.
toPlacemarkfromPlacemarkplacemarkFromAddressplacemarkFromCoordinates
Fixes Android permissions being requested more than once simultaneously, changing getPositionStream to async.
getPositionStream
Changes getPositionStream to take LocationOptions instead of LocationAccuracy.
getPositionStreamLocationAccuracyLocationOptions
Replaces the getPosition and onPositionChanged properties with getPosition and getPositionStream methods that accept a desired accuracy.
getPositiononPositionChangedgetPositionStreamLocationAccuracyLocationAccuracy.Best
Deprecated1
Deprecates the static checkGeolocationStatus method in favor of the instance method checkGeolocationPermissionStatus, with removal planned for version 2.0.
checkGeolocationStatuscheckGeolocationPermissionStatus