persistDirectory method

Future<String> persistDirectory(
  1. PickedDirectoryLocation location
)

Keeps access to location after the app restarts and returns a token for restoreDirectory. See DirPicker.persist.

Platforms: Android · iOS · macOS · Windows · Linux · Web

Throws InvalidInputException for a location the platform can't persist, and NativePlatformException when the platform refuses.

Implementation

Future<String> persistDirectory(PickedDirectoryLocation location) async {
  try {
    return await DirPicker.persist(IOPickedLocation(location.uri));
  } catch (e) {
    throw mapDirPickerError(e, 'Persist directory failed');
  }
}