getLastKnownLocation method

  1. @override
Future<Position?> getLastKnownLocation({
  1. bool useNewerFusedLocationProvider = true,
})
override

Returns the last known position stored on the users device.

On Android you can force the plugin to use the old Android LocationManager implementation over the newer FusedLocationProvider by passing true to the forceAndroidLocationManager parameter. On iOS this parameter is ignored. When no position is available, null is returned.

Implementation

@override
Future<Position?> getLastKnownLocation({bool useNewerFusedLocationProvider = true}) {
  bool useOldVersionLocationManager = !useNewerFusedLocationProvider;
  return Geolocator.getLastKnownPosition(forceAndroidLocationManager: useOldVersionLocationManager);
}