2021年9月20日 星期一

[flutter, install] How to Install Flutter SDK and Create a Project


How to Install Flutter SDK and Create a Project

井民全, Jing, mqjing@gmail.com


1. Install the SDK

Step 1: clone the source

git clone https://github.com/flutter/flutter.git -b stable


Step 2: Setup Path

Mac & Linux

export PATH="$PATH:`pwd`/flutter/bin"

Permanently to add path

vi ~/.bashrc  # for bash

vi ~/.zshrc # for zsh

Ex

epxort PATH="$PATH:/Users/Jing/flutter/bin"


Windows

[設定] ->[關於] -> [進階系統設定] -> [環境變數]: Path

FLUTTER-SDK-PATHr\bin

ex:

C:\Users\jing\src\flutter\bin



Step 3: Run flutter Docter

flutter doctor


Mac

Install cocoapods, if necessary.

sudo gem install cocoapods


iOS Simulator

open -a Simulator

2. Create a project

Procedure

Step 1: Create a project

flutter create myapp

cd myapp


Step 2: Check device

flutter devices


Step 3: Run the project


flutter run


Result

iOS

Windows


3. Clean 

flutter clean


4. References

  1. https://flutter.dev/docs/get-started/install/windows

  2. https://flutter.dev/docs/get-started/install/macos

  3. https://flutter.dev/docs/get-started/test-drive?tab=terminal