requestExternalStoragePermissions method
Requests for full external storage permissions. Required to handle video files and their subtitle files in the same directory.
Implementation
Future<void> requestExternalStoragePermissions() async {
if (isFirstTimeSetup) {
Fluttertoast.showToast(
msg: t.storage_permissions,
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.BOTTOM,
);
}
final cameraGranted = await Permission.camera.isGranted;
if (!cameraGranted) {
await Permission.camera.request();
}
final storageGranted = await Permission.storage.isGranted;
if (!storageGranted) {
await Permission.storage.request();
}
if (_androidDeviceInfo.version.sdkInt >= 30) {
final manageStorageGranted =
await Permission.manageExternalStorage.isGranted;
if (!manageStorageGranted) {
await Permission.manageExternalStorage.request();
}
}
}