getLocation method
dynamic
getLocation()
Implementation
getLocation() {
Geolocator.getLastKnownPosition().then((value) {
LogMessage.d("Location", value.toString());
if (value != null) {
setLocation(LatLng(value.latitude, value.longitude));
} else {
throw "last known location null";
}
}).catchError((er) {
LogMessage.d("Location", er.toString());
const LocationSettings locationSettings = LocationSettings(
accuracy: LocationAccuracy.best,
distanceFilter: 100,
);
Geolocator.getCurrentPosition(locationSettings: locationSettings)
.then((value) {
// if (value != null) {
setLocation(LatLng(value.latitude, value.longitude));
// } else {
// throw "current location null";
// }
}).catchError((er) {});
});
}