preface

When RN came up, we didn’t study it in detail. Now that the official version of Flutter is out, study it. This article mainly introduces the various pits for building Flutter in Windows environment.

The development environment

  • Windows 10
  • Android Studio 3.2.1
  • One plus 5 t

Download the source code of Flutter

Download the source code of Flutter from the official Flutter document as follows:

git clone -b beta https://github.com/flutter/flutter.git
Copy the code

Configuring Environment Variables

After the download, add the bin PATH from the root of the Flutter to the PATH environment variable for future use.

Domestic image setup

Because some students can not scientific Internet reasons, we need to set up the domestic mirror. According to the official document, PUB_HOSTED_URL and FLUTTER_STORAGE_BASE_URL environment variables need to be added. The specific values are as follows

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

## Run the Flutter installer

In the Flutter root directory, students find flutter_console.bat. Then double click to run, the Flutter console will appear, then we execute the Flutter Doctor, wait a while, the installation result of the Flutter will appear.

After installing the Flutter plug-in, you will automatically install the Dart plug-in, and then set the SDK path for both the Flutter and Dart, as shown below

Run the Flutter Demo

After the above installation steps, students must have successfully installed. So we are going to run the Flutter Demo as follows

  • There are several Flutter demos in the examples of the Flutter root directory. We can run the “Flutter run” command in the flutter_gallery root directory to run the Flutter Demo on the mobile phone.
  • Or open flutter_gallery with Android Studio and run the program directly.

The problem

Waiting for another flutter command to release the startup lock…

The solution is as follows:

  • Open task Manager and end all dart.exe
  • If the agent is enabled, disable the agent
  • Restart the AS

Unable to find git in your PATH

This error requires that we set the Git environment variable correctly. We add git’s bin path to the environment variable.

conclusion

The configuration of Flutter on Windows environment is still more pits, encountered problems one by one to solve. Students who can surf the Internet scientifically try to search for solutions to problems on Google, which can solve most of the problems.