getLastKnownPosition static method

Future<Position?> getLastKnownPosition({
  1. bool forceAndroidLocationManager = false,
})

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. Throws a PermissionDeniedException when trying to request the device's location when the user denied access.

Implementation

static Future<Position?> getLastKnownPosition(
        {bool forceAndroidLocationManager = false}) =>
    GeolocatorPlatform.instance.getLastKnownPosition(
        forceAndroidLocationManager: forceAndroidLocationManager);