ccc
ccc

Reputation: 2385

What is the simplest way to list the files from a local folder?

I would like to read a path (not necessarily use a full blown file selector), and list the files in that path and be able to read their contents.

I want it to run on desktop MacOS.

I tried some stuff, but couldn't make it work.

I would appreciate some links, but I would prefer an example, if possible.

Thanks.

Upvotes: 0

Views: 1391

Answers (1)

smorgan
smorgan

Reputation: 21579

Standard dart:io classes like Directory and File work in Flutter desktop applications. If you're having issues using them the most likely explanation is that you haven't disabled the macOS App Sandbox for your application; a sandboxed application can't read arbitrary parts of the filesystem.

Try removing the sandbox entry from your two entitlements files in macos/Runner/ and then testing your code again.

Upvotes: 3

Related Questions