flutterlocation icon indicating copy to clipboard operation
flutterlocation copied to clipboard

add .getOldLocation() function

Open LondonJammo opened this issue 3 years ago • 4 comments

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

LondonJammo avatar May 30 '22 16:05 LondonJammo

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.

KirillArtemenko avatar Jun 20 '22 13:06 KirillArtemenko

Also, if PermissionStatus.grantedLimited is set, the getLocation() method does not immediately return the coordinates.

KirillArtemenko avatar Jun 20 '22 13:06 KirillArtemenko

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

Lyokone avatar Jun 20 '22 13:06 Lyokone