checkPermission function
Checking the permission status, get location permission and get the current location
Implementation
dynamic checkPermission(Future<dynamic> getCurrentLocation) async {
Geolocator.checkPermission().then((geoStatus) {
log("Location: $geoStatus");
if (geoStatus == LocationPermission.denied) {
return Permission.location.request().then((_) => getCurrentLocation);
} else {
return getCurrentLocation;
}
});
}