requestPermissions method

Future<void> requestPermissions()

Request all required permissions to access the existing backup files stored on the Media locations.

Implementation

Future<void> requestPermissions() async {
  // Mandatory `EXTERNAL STORAGE` permission.
  var statusStorage = await Permission.storage.status;
  if (!statusStorage.isGranted) await Permission.storage.request();

  // Optional `MANAGE EXTERNAL STORAGE` permission on API 29+.
  if (useManageExternalStoragePermission) {
    var statusManageStorage = await Permission.manageExternalStorage.status;
    if (!statusManageStorage.isGranted)
      await Permission.manageExternalStorage.request();
  }
}