Flutter development environment installation MAC

Domestic mirroring
For well-known reasons, domestic access to Google services may not be smooth. If there is no VPN environment, you can access domestic mirroring.

Flutter officially built a temporary image for Chinese developers. You can add the following environment variables to the user environment variables:

export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
1
2Note
: This image is temporary and cannot be guaranteed to be always available.

Flutter SDK download and installation
1. Download the sdk
official website download

github download

2. Unzip the installation package to the directory you want to install
cd the directory you want to install
unzip ~/Downloads/flutter_macos_v0.5.1-beta.zip //Unzip to the current directory
1
2
3. Add the Flutter directory to the PATH path
export PATH=you The flutter installation directory /flutter/bin:$PATH
1
If you want the automatic configuration to take effect every time the computer is restarted, add the PATH configuration to .zshrc (or .bash_profile):

export PATH=/Users/apple/Documents/flutter-sdk/flutter/bin:$PATH
1
Here /Users/apple/Documents/flutter-sdk/flutter/ is my Flutter installation path.

Note: The Dart SDK is already bundled in Flutter, there is no need to install Dart separately.

Run flutter doctor
After the configuration is complete, we can run flutter doctor to check whether the installation is successful:

flutter doctor
1
This command checks your environment and displays a report in the terminal window. Examine the command line output carefully for additional software that may need to be installed or further tasks to be performed (shown in bold).


The report will show some problems in the running environment. For example, in the above figure, Xcode and Android Studio are not configured.

Next, we take Android Studio as an example to configure.

Android Studio configuration
1. To install Android Studio,
you should first ensure that Android Studio is installed, and you can install the latest version here. (supports 3.0 or later)

2. Install the Flutter and Dart plugins
You need to install the Flutter and Dart plugins.

Open the plugin preferences: Preferences>Plugins
select Browse repositories..., select the Flutter plugin and click install.
At this time, the Dart plugin will also be installed.
3. Restart the Android Studio
plug-in to take effect, you need to restart Android Studio.

Ok, our Flutter development environment has been set up, and we are ready to develop Flutter applications.

Guess you like

Origin blog.csdn.net/super_man_ww/article/details/127288538