macos_secure_bookmarks
0.3.0, released 7 weeks ago by codeux.design
Creates and manages security-scoped bookmarks to retain macOS sandbox file access across launches
What it does
Provides macOS desktop apps with the ability to create security-scoped bookmarks for files picked by users. It enables apps to resolve stored bookmarks across app restarts to regain sandboxed file access, managing access lifecycles and tracking stale paths. It also supports volume display names and stale bookmark rewrites when files are moved or renamed.
AI-written summary of version 0.3.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- Building a sandboxed macOS Flutter app that needs persistent file access across app relaunches
- Preserving access to user-selected files on external drives or arbitrary folders in macOS App Sandbox
- Handling stale bookmark resolution and scope management when files are renamed or moved
Skip it when
- Developing for non-macOS platforms or apps that run outside the macOS App Sandbox
- Apps that only need temporary file access during a single session without persisting access
Strengths
- Handles stale bookmarks by automatically providing refreshed bytes when target files move or rename
- Provides per-ID security scope management to cleanly enter and release file access
- Returns typed UnresolvableBookmark errors with native NSError domain and code details
Weaknesses
- Platform-exclusive to macOS desktop apps
- Requires manual configuration of macOS sandbox entitlements to function
Setup
- Kind
- Plugin (native code)
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 0
Requires enabling com.apple.security.app-sandbox, com.apple.security.files.user-selected.read-write, and com.apple.security.files.bookmarks.app-scope entitlements in both DebugProfile.entitlements and Release.entitlements.
final SecureBookmarks secureBookmarks = SecureBookmarks();
final SecureBookmarkMint mint = await secureBookmarks.mint(File('/path/to/file'));
// Later, resolve to access:
final SecureBookmarkResolution resolution = await secureBookmarks.resolve(
id: 'my-doc',
bookmarkBytes: mint.bookmark,
);
// Access file at resolution.path, then release:
await secureBookmarks.release('my-doc');Alternatives
Packages that do the same job and could replace macos_secure_bookmarks.
- file_selector_macos
macOS implementation of the file_selector plugin
82Compare - flutter_downloader
Plugin to create and manage background download tasks on Android and iOS.
80Compare - path_provider_android
Android implementation of the path_provider plugin for finding commonly used locations.
79Compare - path_provider_foundation
iOS/macOS implementation of path_provider using direct FFI calls
78Compare