flutterlocation
flutterlocation copied to clipboard
add .getOldLocation() function
We use _locationData = await location.getLocation(); in an async function, however it may take some moments before an accurate location can be found. Perhaps we've lost location, or it's still trying to do the first get.
I've seen other packages that have location.getLastLocation() which can be used in the meantime to offer the user a last known position (with a timestamp) before the current location has been found. This can be used in conjunction with a grey location marker, instead of blue
I noticed that on some phones (not all), if you turn off the precise location when allow location request, then the location does not come immediately, only after 5-7 minutes and it is impossible to get it. It seems like the stream onLocationChanged is skipping first update.
A method for getting the last known location would be very useful in this case.
Also, if PermissionStatus.grantedLimited is set, the getLocation() method does not immediately return the coordinates.
Hello :) The method have been added in Location 5, you can check the example here: https://docs.page/Lyokone/flutterlocation/features/get-location#with-custom-settings