DEV Community

loading...

Discussion on: How to install Flutter on macOS using homebrew and asdf

Collapse
akarsh profile image
akarsh

@0xdonut

Suggestion to add the location of Flutter SDK location in the guide.

At the end of the guide, you can add about how to find the location of Flutter SDK on macOS. I had to spend some time and search on the internet to know where asdf installs the plugins. If you want to start a flutter project in Android Studio you need to manually give the Flutter SDK location. I added the steps to find the location to this StackOverflow question - stackoverflow.com/a/60575597/1334228

Collapse
pshah2023 profile image
PranitSh

I asked the people that made the flutter plugin and they helped me out. For making flutter work with your IDE (haven't done this in Android but have in VScodium or Vscode). Answer On Stack

In command line:
asdf where flutter

In a text document:
export FLUTTER_ROOT="$/asdf/where/flutter/should/go/here"

Add that to your bash_profile above the asdf part. Or your asdf installation won't work.
With nano, ctrl o, enter, ctrl x.

Give your IDE the path to the installation of asdf where flutter (I accidentally gave it the path to the shim, it didn't worked but I restarted my computer and it did). So, if it didn't work, the change needs to take effect, restart your computer.

Collapse
0xdonut profile image
Mr F. Author

Hmm that's odd.

You can find which flutter versions you have by doing

$ asdf list flutter
> 1.12.13+hotfix.7-stable

to get the path you just need to do

$ which flutter
 >  /Users/0xDonut/.asdf/shims/flutter

you can use this output to inform android studio

Collapse
jaysephjw profile image
Jay

This didn't work for me- ~/.asdf/shims/flutter is the executable, whereas Android Studio wants the directory. This is a problem for the Dart plugin too.

I can use ~/.asdf/installs/flutter/<version>, but now I'm not honoring asdf's global selection (or its local one if .tool-versions is in the project).

(btw thanks for the write up!)