I had the same problem. I tried so hard to solve it, and I finally found the solution in this page: Flutter pub.get stopped working, even on vanilla install : socket error trying to find package xxx

It is because of the antivirus (which is SOPHOS I use with my Mac). I uninstalled it and it works perfectly


You need to correctly set up your flutter path.

from here

Determine the directory where you placed the Flutter SDK. You will need this in Step 3. Open (or create) $HOME/.bash_profile. You can do that by using terminal text editor by going in terminal and typing nano ~/.bash_profile macOS Catalina uses the Z shell by default, so edit $HOME/.zshrc.

If you are using a different shell, the file path and filename will be different on your machine.

Add the following line and change [PATH_TO_FLUTTER_GIT_DIRECTORY] to be the path where you cloned Flutter’s git repo: export PATH=[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin:$PATH

for example:

export PATH=~/Documents/flutter/bin:$PATH

press CTRL X and when it asked you to save the file, choose yes

Run source $HOME/.bash_profile to refresh the current window or restart the terminal

Verify that the flutter/bin directory is now in your PATH by running: echo $PATH

Notice that [PATH_TO_FLUTTER_GIT_DIRECTORY] is where you installed flutter SDK, not the location of your app

Instead of nano, you can use any text editor to edit ~/.bash_profile

Related Query

More Query from same tag