updateCurrentLocation method

Future<void> updateCurrentLocation(
  1. bool forceAndroidLocationManager
)

Implementation

Future<void> updateCurrentLocation(bool forceAndroidLocationManager) async {
  try {
    await Permission.location.request();
    if (await Permission.location.request().isGranted) {
      currentPosition = await Geolocator.getCurrentPosition(
          desiredAccuracy: desiredAccuracy ?? LocationAccuracy.best);
    } else {
      currentPosition = null;
    }
  } catch (e) {
    debugPrint(e.toString());
    currentPosition = null;
  }

  notifyListeners();
}