[*] Entry Flutter

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/Maiduoudo/article/details/97264736

Chinese official website: https://flutterchina.club/

Build process from Flutter Chinese official website.

Flutter development environment built on Windows

Mirroring

Since the country visit Flutter may sometimes be limited, Flutter official build a temporary image for the Chinese developers, we can be as an environment variable added to the user environment variables:

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

Note:  This is a temporary mirror image, does not guarantee always available, readers can refer to please refer to  Using Flutter in China  in order to obtain information about the latest developments mirror server.

 

System Requirements

To install and run Flutter, your development environment must meet the following minimum requirements:

  • Operating System : Windows 7 or later (64-bit)
  • Disk Space : 400 MB (not including Android Studio disk space).
  • Tools : Flutter these depend on the following command-line tools.
    • For Windows Git  (git command-line tool)

      If Git for Windows is already installed, be sure to run PowerShell command prompt or in  git command, or running back flutter doctorwill occur when Unable to find git in your PATHan error, this time needs to be added manually C:\Program Files\Git\binto the Pathsystem environment variable.

Get Flutter SDK

  1. To flutter its official website to download the latest installation package available, click to download  ;

    Note that the channel will keep shifting version of Flutter, Flutter please the official website shall prevail. In addition, in mainland China, in order to properly get a list of installed packages or download the installation package, you may need over the wall, readers can also go Flutter github project to go download the installation package  .

  2. Zip unzip the installation package to the path you want to install Flutter SDK (such as: C:\src\flutter; pay attention, do not install the flutter to need some high authority, such as a path C:\Program Files\).

  3. In Flutter installation directory flutterto find the next file flutter_console.bat, double-click to run and start the flutter command line , then you can run a command line command Flutter flutter up.

Note:  Because some fluttercommands need to get data networking, if you are in-country visit, due to reasons known, direct access to it may not be successful. The above PUB_HOSTED_URLand FLUTTER_STORAGE_BASE_URLis google for domestic developers to build temporary image. Please refer to  Using Flutter in China

The above command set for the current temporary window terminal PATH variable. To Flutter permanently added to the path, see update path .

To update an existing version of Flutter, please refer to the upgrade Flutter .

 

Updating environment variables

To run the terminal  flutter command, you need to add the following environment variable to the system PATH:

  • Go to "Control Panel> User Accounts> User Accounts> Change my environment variables"
  • Is there an entry named "Path" in the "User Variables" under examination:
    • If the entry exists, adding  flutter\binthe full path, used  ; as a separator.
    • If an entry does not exist, create a new user variable  Path , then the  flutter\binfull path as its value.
  • Is there an entry called "PUB_HOSTED_URL" and "FLUTTER_STORAGE_BASE_URL" in the "User Variables" under examination, and if not, add them.

Restart Windows to apply this change

 

Run flutter doctor

Open a new command prompt or PowerShell window and run the following command to see if you need to install any dependencies to complete the installation:

 flutter doctor

Run this command at a command prompt or PowerShell window. Currently, Flutter does not support third-party such as Git Bash shell.

The command to check your environment and display the report in a terminal window. Dart SDK has been bundled Flutter again, and there is no need for a separate installation Dart. Double-check command line output for additional software may need to install or further tasks to be performed (shown in bold)

E.g:

[-] Android toolchain - develop for Android devices
    • Android SDK at D:\Android\sdk
    ✗ Android SDK is missing command line tools; download from https://goo.gl/XxQghQ
    • Try re-installing or updating your Android SDK,
      visit https://flutter.io/setup/#android-setup for detailed instructions.

The first time you run a flutter command (such as flutter doctor), it will download its own dependencies and compile it yourself. Later it will run much faster.

The following sections describe how to perform these tasks and complete the setup process. You will see in flutter doctorthe output, if you choose to use IDE, we offer a plug-in IntelliJ IDEA, Android Studio and VS Code, see Editor settings  steps for installation Flutter and Dart plug-ins.

Once you install any missing dependency, rerun flutter doctorcommand to verify that you've correctly set up.

The flutter tool uses Google Analytics reporting anonymous usage statistics and crash reports basic. This data is used to help improve Flutter tool. Analytics is not involved in running a run or flutter configto send any commands, so you can analyze exit before sending any data. To disable report, perform flutter config --no-analyticsand display the current setting, and then executed flutter config. See Google's privacy policy .

 

Editor Settings

Use  flutter the command-line tool, you can use any editor to develop Flutter application. Enter flutter helpto view the available tools at the prompt.

We recommend using our plug-in to get rich IDE experience , support for editing, running and debugging Flutter application. See Editor settings for more steps

 

Android settings

Android Studio installed

To Flutter developed for Android application, you can use the Mac, Windows or Linux (64-bit) machine.

Flutter need to install and configure Android Studio:

  1. Download and install  Android Studio .

  2. Start Android Studio, and then perform "Android Studio Setup Wizard." This will install the latest Android SDK, Android SDK and Android SDK platform tools to build tool, which is developed for Android Flutter when necessary

Set up your Android device

To prepare to run and test your application on Flutter Android device, you need to install the Android 4.1 (API level 16) or a later version of Android devices.

  1. Enabled on your device  developer options  and  USB debugging  . A detailed description can in the Android documentation found in.
  2. Using a USB phone into the computer. If your device when prompted, please authorize your computer to access your device.
  3. In the terminal, run  flutter devices command to verify Flutter identify your connected Android device.
  4. Start your application run  flutter run.

By default, Android SDK version Flutter is based on your use of the  adb tool version. If you want Flutter use different versions of the Android SDK, you must the  ANDROID_HOME set the environment variable for the SDK installation directory.

 

Android emulator settings

To prepare to run and test your application on the Android emulator Flutter, follow these steps:

  1. Enabled on your machine  VM Acceleration  .
  2. Start  Android Studio> Tools> Android> AVD Manager  and select  the Create Virtual Device .
  3. Select a device and select  the Next .
  4. Select the Android version to simulate one or more system image, and then select  the Next . Recommended  x86  or  x86_64  Image.
  5. In Emulated Performance, select  Hardware - GLES 2.0  to enable  hardware acceleration .
  6. Verify AVD configuration is correct, then select  Finish .

    For more information about these steps, see  Managing AVDS .

  7. In the Android Virtual Device Manager, click on the toolbar of  the Run . Emulator Start splash screen and display the selected operating system or device.
  8. Running  flutter run start your device. The device name is connected  Android SDK built for <platform>, in which the  platform  is a chip series, such as x86.

Guess you like

Origin blog.csdn.net/Maiduoudo/article/details/97264736