You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am building an application for a tutorial that I am writing and I am finding that when I use any of the methods aside from lastKnownLocation(), I can't get access to the one shot data in the streams using the await for construct.
From what I can tell based on the documentation, the currentLocation() method should just be a stream with a single value inside of it and yet when I write something like the block below, the application just sits indefinitely waiting for the stream to complete (I tried adding an onDone and onError to see if there were any problems in that regard).
getLocation() async {
LocationResult location;
Stream<LocationResult> results = Geolocation.currentLocation(
accuracy: LocationAccuracy.best, inBackground: false);
await for (LocationResult data in results) {
location = data;
}
return location;
}
I did a bit of debugging and it seems that the data and location variables stay null the entire time the function is running. Am I just missing something here?
Also, I have a question regarding the lastKnownLocation() function. Based on the android documentation, it should change with some degree of frequency and yet, even if I turn off the GPS and rebuild the application, the last known location will not change unless I power down the emulator and reboot it. Is this just how it works or is it something else?
The text was updated successfully, but these errors were encountered:
I am building an application for a tutorial that I am writing and I am finding that when I use any of the methods aside from
lastKnownLocation()
, I can't get access to the one shot data in the streams using theawait for
construct.From what I can tell based on the documentation, the
currentLocation()
method should just be a stream with a single value inside of it and yet when I write something like the block below, the application just sits indefinitely waiting for the stream to complete (I tried adding an onDone and onError to see if there were any problems in that regard).I did a bit of debugging and it seems that the data and location variables stay null the entire time the function is running. Am I just missing something here?
Also, I have a question regarding the
lastKnownLocation()
function. Based on the android documentation, it should change with some degree of frequency and yet, even if I turn off the GPS and rebuild the application, the last known location will not change unless I power down the emulator and reboot it. Is this just how it works or is it something else?The text was updated successfully, but these errors were encountered: