checkPermission function

dynamic checkPermission(
  1. Future getCurrentLocation
)

Checking the permission, get location permission and get the current location

Implementation

dynamic checkPermission(Future<dynamic> getCurrentLocation) async {
  Geolocator.checkPermission().then((geoStatus) {
    log("GEO: $geoStatus");
    if (geoStatus == LocationPermission.denied) {
      Permission.location.request().then((_) =>
          getCurrentLocation);
    } else {
      getCurrentLocation;
    }
  });
}