How to set up a flutter development environment

To learn Flutter, you first need to set up a Flutter development environment. Below I will lead you step by step to set up a development environment and successfully run the Flutter project.

1. Basic requirements of the system

Operating system: Windows 7 or above 64-bit operating system
Git environment: Flutter needs the support of git environment

2. Java environment installation

Because Flutter is based on Android, a Java environment must be installed

  1. Java environment download address: https://www.oracle.com/java/technologies/downloads/#java8-windows
  2. Select the corresponding file type to install according to your system
    Insert image description here
  3. After entering java in the terminal, if you can see the following content, it means that the Java environment has been installed successfully.Insert image description here

3. Install Flutter SDK

  1. flutter download address: https://docs.flutter.dev/release/archive#windows
  2. Choose the flutter version you need. I chose the latest version.
    Insert image description here
  3. Download and unzip it. When you open the unzipped file, you will see the flutter_console file (tip: when using the flutter command later, you need to double-click this file to enter and then execute the flutter-related commands.)
    Insert image description here
  4. Double-click the flutter_console file, and then enter flutter -h on the command line. You can see the flutter related commands. This means that flutter is installed successfully.Insert image description here
  5. Although flutter was successfully installed, we need to use the flutter doctor command to check flutter. Insert image description here
    The result shows: Android Studio is not installed, so Android Studio needs to be installed.

4. Install Android Studio

  1. Download address: https://developer.android.google.cn/studio

  2. Then click directly on the zip file to download and unzip it
    Insert image description here

  3. After unzipping, enter the following folder and click on the studio64 application to enter Android StudioInsert image description here

  4. Then keep clicking Next, then choose to accept the installation, and finally click Finsh to download the relevant components.Insert image description here

  5. After downloading the relevant components, install flutter in Android StudioInsert image description here

  6. After the installation is complete, restart Android Studio
    Insert image description here

  7. We continue to execute flutter doctor, and an error message like cmdline-tools component is missing appears, so we need to download the latest SDK Tools in Android Studio.
    Insert image description here

  8. Download the latest SDK Tools in Android Studio
    Insert image description here
    Insert image description here

  9. Continue to execute flutter doctor, and some Android licenses not accepted appear. Run flutter doctor --android-licenses and select Y until completed. Insert image description here
    Next, we can start the flutter project

5. Start the flutter project

  1. Choose to create a new flutter project

  2. Select the Flutter SDK installation location (the third step)

  3. Enter the project name and select the creation location (it is best not to have Chinese characters, otherwise an error may occur when starting the project), and then click create
    ![Insert image description here](https://img-blog.csdnimg.cn/0d59c2d8d01f40d189d99c9c568d69b0.png5.

  4. After the creation is successful, the main.dart file will be automatically opened, indicating that the flutter project has been successfully created.Insert image description here5. 5.

  5. Turn on the virtual machine and start the project
    Insert image description hereInsert image description here
    Insert image description here
    Insert image description here
    Insert image description here

  6. The startup may be very slow. You can modify the image source to solve this problem
    (1) Change the image in build.gradle in the project
    Insert image description here
    (2) Also replace the images of these two files in the Flutter SDK.
    Insert image description here
    Insert image description here
    Insert image description here

  7. Finally, restart the project and you can see the examples that come with Flutter. Click the plus sign to increase the value.Insert image description here

At this point, a flutter project is up and running! Was yours successful?

Guess you like

Origin blog.csdn.net/weixin_43534452/article/details/130670159