macos_secure_bookmarks

Last updated:

0 purchases

macos_secure_bookmarks Image
macos_secure_bookmarks Images
Add to Cart

Description:

macos secure bookmarks

macos_secure_bookmarks #

Flutter plugin to create secure bookmarks to keep access to files in sandboxed apps.
Usage #

Check the documentation on security-scoped bookmarks
Make sure to enable the necessary entitlements

com.apple.security.files.bookmarks.app-scope



Creating Security Scoped Bookmarks #
// First let the user choose a file, e.g. using the file chooser plugin.

showOpenPanel((result, files) {
if (result != FileChooserResult.ok || files.isEmpty) {
return;
}

// Now create a security scoped bookmark
final secureBookmarks = SecureBookmarks();
final bookmark = await secureBookmarks.bookmark(File(_file));

// Now store the bookmark somewhere for later invocations
});
copied to clipboard
Resolving and accessing bookmarks #
// resolve bookmark from persistet 'bookmark' string from earlier
final resolvedFile = await _secureBookmarks.resolveBookmark(_bookmark);
// resolved is now a File object, but before accessing it, call:
await startAccessingSecurityScopedResource(resolvedFile);

// now read/write the file

// and later give up access.
await stopAccessingSecurityScopedResource(resolvedFile);

copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.