Mastodon hachyterm.io

I’ve been playing around with Flutter lately.
Flutter is a framework for app development based on the Dart language. I’ve always been interested in creating mobile apps but so far it’s taken a backseat to learn web development.

But Flutter proved to be a joy so far. Dart, the underlying language, has lots of similarities to JavaScript, so it’s easy to pick up. It looks like a better designed, object-oriented JavaScript with static types.

On Arch Linux, it’s easy to install Flutter and Dart. The pain points so far have been with getting Android Studio/Android SDK to work on my computer.

However, I got strange errors yesterday when I wanted to run Flutter:

Cannot open file, path ='/opt/flutter/bin/cache/' Permission denied

Neither flutter run nor flutter doctor worked.

It looks like the current user doesn’t have write permissions for the flutter directory. This happened after I updated Flutter via Android Studio.

The solution:

sudo chown -R $USER /opt/flutter

Give write permission to the current user.

Edit: Another way is to add a flutterusers group, and add the normal user to the group. Then give permissions to the folder /opt/flutter:

sudo groupadd flutterusers
sudo gpasswd -a <user> flutterusers
# make directory writable
sudo setfacl -R -m g:flutterusers:rwx /opt/flutter
# the default group has "allow execution if executable by the owner (or anywone else)"
sudo setfacl -d -m g:flutterusers:rwX /opt/flutter

Further Reading