startAccessingSecurityScopedResource method

Future<bool> startAccessingSecurityScopedResource({
  1. required Uint8List bookmark,
})

macOS: Attempt to start security-scoped access for a bookmarked URL.

Pass the DropItem.extraAppleBookmark bytes from a dropped file that originated outside the app container. Returns true if access began.

If bookmark is empty, this function returns false and does not invoke the platform call. Promise files written under your container do not require security-scoped access.

Implementation

Future<bool> startAccessingSecurityScopedResource(
    {required Uint8List bookmark}) async {
  if (bookmark.isEmpty) return false;
  Map<String, dynamic> resultMap = {};
  resultMap["apple-bookmark"] = bookmark;
  final bool? result = await _channel.invokeMethod(
      "startAccessingSecurityScopedResource", resultMap);
  if (result == null) return false;
  return result;
}