getCurrentUserLocation function
Implementation
Future<LatLng> getCurrentUserLocation(
{required LatLng defaultLocation, bool cached = false}) async {
if (cached && cachedUserLocation != null) {
return cachedUserLocation!;
}
return queryCurrentUserLocation().then((loc) {
if (loc != null) {
cachedUserLocation = loc;
}
return loc ?? defaultLocation;
}).onError((error, _) {
print("Error querying user location: $error");
return defaultLocation;
});
}