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) {
    print(e);
    currentPosition = null;
  }

  notifyListeners();
}