Create a folder called flutter- SDK under your Desktop

The following law. Luo is the user name (change to your user name)

/Users/law.luo/Desktop/flutter-sdk
Copy the code

Download the MAC installation package from the official website

Flutter_macos_1. 22.5 stable. ZipCopy the code

Dump the installation package into the flutter- SDK folder

cd flutter-sdk
Copy the code
Unzip flutter_macos_1. 22.5 stable. ZipCopy the code

This code can only temporarily set the path environment variable to the current command line window.

/ / / flutter - SDK directory in the current input enter the export PATH = ` PWD ` / flutter/bin: $PATH / / is equivalent to / / PWD - > / Users/law luo/Desktop/flutter - SDK / /  export PATH=/Users/law.luo/Desktop/flutter-sdk/flutter/bin:$PATHCopy the code

Method two: global variables

vim $HOME/.bash_profile
Copy the code

add

export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH=$PATH:/Users/law.luo/Desktop/flutter-sdk/flutter/bin:$PATH
Copy the code
source $HOME/.bash_profile
Copy the code

To view

echo $PATH
flutter doctor
Copy the code

Restart VS Code method 3:

Manually add SDK" Locate SDK" select the Flutter -> bin folder and restart VS Code Restart Create a Flutter project automatically generate dependent files as followsCopy the code

Normal flutter project

Run the following command under the /flutter- SDK folder to see if additional dependencies need to be installed to complete the installation:

Flutter doctor // or flutter doctor-vCopy the code

If any of the following errors occur:

Flutter doctor -- Android -licenses // yes All yesCopy the code
  • Install Android Stdio (Android-Studio-IDE-201.6953283-Mac.dmg)
  • Go to the App Store and install xCode
  • Install the Flutter plugin in VS Code
https://developer.android.com/studio/index.html
Copy the code
sudo xcodebuild -license
// yes
// agree
Copy the code

Brew Install Cocoapods is executed in the root directory of the project by default.

RVM install 2.5.8 // Sudo gem install -n /usr/local/bin cocoapods // cocoapods pod setupCopy the code

If you install the Flutter doctor plugin and restart the terminal on a MAC or Android Studio 4.1 environment, an error is reported

Ln -s ~ / Library/Application/Support/Google/AndroidStudio4.1 / plugins ~ / Library/Application/Support/AndroidStudio4.1Copy the code

Deploy the FLUTTER SDK into the system environment path in VS Code