Cannot access files from snap

Hello. I am very new to snaps and trying to make a snap of a flutter application. My app needs to access certain system files. The app tries to access /usr/share/color-schemes and /home/$USER/.local/share/color-schemes for both reading and writing.
I have tried to add a plug but it didn’t work.

interface: system-files
  - /usr/share/color-schemes
  - /home/$USER/.local/share/color-schemes

It also seems that the app cannot access some cli apps which is used by the app.

you need to define one interface per directory … and also watch your indentation, yaml is very sensitive to that …

after you built your snap with the interfaces, do not forget that you need to manually connect them with the snap connect ... command.

Thanks! It worked. But Now I have another problem. It seems that the snap doesn’t has access to all shell programs. My program use an external shell command which seems not to be accessible from the snap. I tried to access it by absolute path but it is still missing some shared libraries.

Snap packages are self contained and have no direct access to host file system, in this case the “shell programs” you mentioning need to be in your snap package. That ensure the very fundamental reason to choose snap package i.e, they are made to run on any system(where the user do not have those shell programs installed on his host).

The solution would be: have shell program installed on you snap package itself.

The program is actually a part of plasma workspace. Do you know any extension that can support this? I am using flutter otherwise I would have used classic confinement.

What is the external shell utility that your app is calling? You can simply add the package for that app in your stage-packages list, you app will be able to call it.

The shell utility is plasma-apply-colorscheme which is a part of plasma workspace. If I add it to stage packages then will it be called from the system or a copy of the package will be made inside snap and then will be called?

No, that will not work.
I am not the KDE expert, so do not know how the utility work actually. I put some effort searching the utility mentioned online but the query returned no relevant results. Reading the utility manual and how it work is necessary cause once you understand how the utility works you will be able to decide how to use it from your snapped app package. Ultimately if closed confinement packaging do not fix the issue, you can learn more and ask for classic confinement here( giving the appropriate information about why you need it.