platformPersistentAccessBackend function

PersistentAccessBackend platformPersistentAccessBackend({
  1. PersistentAccessEntityKind? macOSLegacyHandleKind,
})

Creates the built-in backend for the current desktop platform.

macOSLegacyHandleKind is required only when a macOS mixed-kind store must read untagged bookmarks written by an older version. Prefer MacOSPersistentAccessBackend.forEntityKind for a homogeneous legacy store.

Implementation

PersistentAccessBackend platformPersistentAccessBackend({
  final PersistentAccessEntityKind? macOSLegacyHandleKind,
}) {
  if (Platform.isMacOS) {
    return MacOSPersistentAccessBackend(
      legacyHandleKind: macOSLegacyHandleKind,
    );
  }
  if (Platform.isWindows) {
    return const WindowsPathPersistentAccessBackend();
  }
  throw UnsupportedError('persistent_file_access supports macOS and Windows.');
}