Running it, however, resulted in the "permission denied" error below.
$ flutter doctor touch: cannot touch '/opt/flutter/bin/cache/.dartignore': Permission denied
Should I have done it as root, superuser? No. It is not recommended.
$ sudo flutter doctor Woah! You appear to be trying to run flutter as root. We strongly recommend running the flutter tool without superuser privileges.
Invite the user to "flutterusers" group.
Here is an Arch Linux example. Run this command:
$ sudo gpasswd -a $USER flutterusers
Log out and login again.
flutter doctor again.
$ flutter doctor Building flutter tool...
Alternatively, it may be solved by changing
/opt/flutter permission. But it is perhaps less recommended.
$ sudo chown -R <your-user>: /opt/flutter