cameraAndStoragePermissionsGranted static method
Checking that camera and storage permission granted or not (Platform vise)
Implementation
static Future<bool> cameraAndStoragePermissionsGranted() async {
PermissionStatus cameraPermissionStatus = await _getCameraPermission();
switch (Platform.isAndroid ? 1 : 0) {
///For Android
case 1:
PermissionStatus storagePermissionStatus =
await _getStoragePermission();
if (cameraPermissionStatus == PermissionStatus.granted &&
storagePermissionStatus == PermissionStatus.granted) {
return true;
} else {
_handleInvalidPermissions(
cameraPermissionStatus, storagePermissionStatus);
return false;
}
///For iOS
case 0:
if (cameraPermissionStatus == PermissionStatus.granted) {
return true;
} else {
_handleInvalidPermissions(cameraPermissionStatus, null);
return false;
}
default:
return false;
}
}