Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”. I have learned about flutter briefly before. Today, I start to learn about flutter and record the knowledge points about flutter learning.

1. The Flutter installation

There are many online tutorials about how to install A FLUTTER. Here you can document your own environment for installing a Flutter, on the official website of Flutter

Click and select Install. We select macOS environment

Here we choose the stable version to download

  • 1.1 Decompress and install the Flutter SDK

  • 1.2 Configuring the Image File

You can refer to the official website to configure the image file after decompression

If you install or use Flutter in China, it may be helpful to use a trusted local mirror site that hosts Flutter dependencies. To instruct the Flutter tool to use an alternate storage location, you need to be runningflutterThe preceding command sets two environment variablesPUB_HOSTED_URLandFLUTTER_STORAGE_BASE_URL.

 export PUB_HOSTED_URL=https://pub.flutter-io.cn
 export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
Copy the code

The new Mac terminals use ZSH, whose configuration file path is ~/.zshrc.

Older Mac terminals use bash and its configuration file path is ~/.bash_profile.

The default after the new system iszshIn this case, we will have two configuration files, so we only need tozshrcAdd the following command at the end of the file, you can directlybash_profileAll environment variables in the file are introducedzshrc

if [ -f ~/.bash_profile ]; then 
    . ~/.bash_profile;
fi

Copy the code

We configure

export PUB_HOSTED_URL=https://pub. Flutter - IO. Cn
export FLUTTER_STORAGE_BASE_URL=https://storage. Flutter - IO. Cn
export PATH=/Users/* * * * */ * * * * /flutter/bin:$PATH
Copy the code

After the configuration is complete, restart the terminal, or directly enter the command in the terminal to reload the configuration:

Source ~/.zshrc # bash source ~/.bash_profileCopy the code

2. The android studio installation

We know that Flutter is developed cross-platform, using Xcode and Android, Android StudioDownload Mac addressAmong themWe can follow the wizard to install, then need to install several SDKS

Install the Android SDK Command line Tools

  • Installing a plug-in

We need to install two plug-ins, The Flutter and dart, and then restart to create the Flutter project

3. Verify

Terminal input flutter doctor:

Basically there are no problems and some warnings can be ignored. Let’s create a Flutter project and run it to try it out

Create a default Flutter project and run it with Xcode. The first flutter project takes a long time.