getLocalPath static method

dynamic getLocalPath()

Implementation

static getLocalPath() async {
  Directory? appDir;
  if (Platform.isIOS) {
    appDir = await getApplicationDocumentsDirectory();
  } else {
    appDir = await getExternalStorageDirectory();
    PermissionStatus status = await Permission.storage.status;
    if (status == PermissionStatus.denied) {
      status = await Permission.storage.request();
      if (status == PermissionStatus.denied) return null;
    }
  }
  String appDocPath = appDir!.path + '/SaveImageTemp';
  Directory appPath = Directory(appDocPath);
  await appPath.create(recursive: true);
  return appPath;
}