Flutter Permission Denied

04/09/20191 Min Read — In Flutter

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.

Further Reading