filePermission static method

Future<bool> filePermission()

文件保存权限

Implementation

static Future<bool> filePermission() async {
  if (await Permission.storage.status.isDenied) {
    if (await Permission.storage.status.isPermanentlyDenied) {
      return openAppSettings();
    }
    var request = await Permission.storage.request();
    if (request.isDenied) {
      return request.isGranted;
    }
  }

  if (await Permission.manageExternalStorage.status.isDenied) {
    if (await Permission.manageExternalStorage.status.isPermanentlyDenied) {
      return openAppSettings();
    }
    var request = await Permission.manageExternalStorage.request();
    if (request.isDenied) {
      return request.isGranted;
    }
  }
  return true;
}