requestLocationPermission static method
Implementation
static Future<Map<String, bool>> requestLocationPermission() async {
String location = 'Location';
if(kIsWeb){
return {location: true};
}else{
try {
PermissionStatus status = await Permission.location.status;
if (status == PermissionStatus.granted) {
// Gallery permission is already granted
return {location: true};
} else if (status == PermissionStatus.denied) {
// Gallery permission is denied, request it
PermissionStatus newStatus = await Permission.location.request();
return newStatus == PermissionStatus.granted
? {location: true}
: {location: false};
}
} catch (e) {}
return {location: false};}
}