Flutter on pit

Configure the environment

Vim ~/.bash_profile //.bash_profile adds the followingexport PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
Copy the code

Download the SDK

Download the SDK

The installation

cd~ / development unzip ~ / Downloads/flutter_macos_v0. 5.1 beta. ZipCopy the code

Setting environment Variables

Vim ~/.bash_profile //.bash_profile add the following,pwdIt's the path of the flutterexport PATH=`pwd`/flutter/bin:$PATH// If the command line is ZSH vim ~/.zshrc //.zshrc add the following,pwdIt's the path of the flutterexport PATH=`pwd`/flutter/bin:$PATH

source ~/.bash_profile
source ~/.zshrc
Copy the code

vscode

Install the Flutter plug-in

  1. Start VS Code
  2. Call the View > Command Palette…
  3. Type ‘Install’ and select Extensions: Install Extension Action
  4. Enter flutter in the search box, select ‘flutter’ in the list of search results, and then click Install
  5. Select ‘OK’ to restart VS Code

Verify your Settings with Flutter Doctor

  1. Call the View > Command Palette…
  2. Enter ‘doctor’ and then select ‘Flutter: Run Flutter Doctor’ action
  3. See if there is a problem with the OUTPUT in the OUTPUT window

Configuration vscode

Select the folder to place the Flutter and select the path strength of the bin folder

Creating a new application

  1. Start VS Code
  2. Call the View > Command Palette…
  3. Enter ‘flutter’ and select ‘flutter: New Project’ action
  4. Enter a Project name (such as MyApp), then press Enter (this may take a long time)
  5. Specify where to place the item, and then press the blue OK button
  6. Wait for the project creation to continue and display the main.dart file

The above commands create a Flutter project called MyApp that contains a simple demo application using Material components.

In the project directory, your application’s code is located in lib/main.dart.

Run the application

  1. Make sure the target device is selected in the lower right corner of VS Code
  2. Press F5 or call Debug>Start Debugging
  3. Wait for the application to start

The related documents

  • Flutter configuration for Mac — VSCode