getCurrentLocation function

Future<bool> getCurrentLocation()

Implementation

Future<bool> getCurrentLocation() async {
  var permission = await Geolocator.checkPermission();
  if (permission == LocationPermission.denied) {
    permission = await Geolocator.requestPermission();
    if (permission == LocationPermission.denied)
      return false;
  }
  Position pos = await _getCurrent();
  userCurrentLatitude = pos.latitude;
  userCurrentLongitude = pos.longitude;
  return true;
}