Flutter MacOs access to files

Tizianoreica

I'm trying to build app a custom desktop app in Flutter to be able to load pictures, like a gallery. To do so, I will ask to the user to pick a folder, and automatically it should show the pictures.

Now, starting from simple things, since it's first time developing for Mac, I'm just trying to display a picture via Image.file(new File) method.

The issue that I got back is 

======== Exception caught by image resource service ================================================
The following FileSystemException was thrown resolving an image codec:
Cannot open file, path = 'media/preview.jpg' (OS Error: Operation not permitted, errno = 1)

I'm thinking somehow is related to the entitlements. What I have on my entitlements is:

<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
<key>com.apple.security.assets.downloads.read-write</key>
<true/>
<key>com.apple.security.assets.pictures.read-write</key>
<true/>
<key>com.apple.security.assets.downloads.read-write</key>
<true/>

But since the folder from where I want to load the pictures could be anywhere, I wonder if this is the reason why I get the error.

Tizianoreica

So it seems that as long as your app is in the sandbox it looks like it can only open files outside of those folders (Downloads, Pictures, Music, and Movies) if the user selects them from an open dialog.

So for development purpouse I've disabled the sandboxing, conscious of the fact I could not distribute on the Apple Store.

But at least I can develop. Enjoy

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to access methods in a Flutter for desktop (macOS) app

Flutter How to store and access files with AssetBundle

Service running on macOS cannot access files on attached volumes

MacOS App Sandboxing - read access to referenced files from parsed xml

How to stop access user to audio files in app with flutter?

How can I access files in a particular directory in my flutter app

Firebird 3 on macOS, local connection fails with: Can not access lock files directory /tmp/firebird/

Temporarily disable files in macOs

Is there an alternative to macOS that runs macOS .app files?

Flutter macOS high Sierra error

Flutter MacOS MethodChannel Communication to AppDelegate

Under Catalina MacOS 10.15 PHP under Apache has restricted access to some files via file links possibly by privacy changes

Github action macos keychain access

synchronize files with different extension in MacOS

Prevent MacOS from making .* and ._* files

SwiftUI MacOS QuickLook preview of files

Electron macOS: Change icon of files

Which files get to the Recent files in MacOS?

Access Object Data in Flutter

Flutter access variables in state

Access to Firebase Storage in Flutter

Not able to access the provider in flutter

Flutter access var dynamically

Flutter: Access BlocProvider with a GlobalKey

Trouble installing flutter on macOS High Sierra

Flutter - Trouble launching app for debug on macOS

What is the recommended path to place flutter SDK on MacOS?

Flutter bad file descriptor error on MacOS

Flutter RawKeyboardListener triggering system sounds on MacOS