accessAppleScopedResource method
Future<void>
accessAppleScopedResource(
- Future<
void> action(- bool hasAccess,
- FcFilePickerPath pickerPath
Implementation
Future<void> accessAppleScopedResource(
Future<void> Function(bool hasAccess, FcFilePickerPath pickerPath)
action) async {
if (uri == null || path == null) {
return;
}
if (!Platform.isIOS && !Platform.isMacOS) {
return;
}
bool hasAccess = false;
try {
hasAccess =
await _plugin.startAccessingSecurityScopedResourceWithURL(uri!);
await action(hasAccess, this);
} finally {
if (hasAccess) {
await _plugin.stopAccessingSecurityScopedResourceWithURL(uri!);
}
}
}