安裝Flutter

Mac OS

第一步:下載SDK
這裡去下載SDK包並解壓縮到你的資料夾

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

第二步:設定路徑

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

根據官網解釋,此命令僅將PATH變量設置為當前終端窗口。

設定永久Flutter路徑

可以看update-your-path
先打開你的.bash_profile

vim .bash_profile

其中 [PATH_TO_FLUTTER_GIT_DIRECTORY] 就是你存放flutter sdk包的路徑位置

$ export PATH="$PATH:[PATH_TO_FLUTTER_GIT_DIRECTORY]/flutter/bin"

再打開terminal運行source $HOME/.bash_profile以刷新當前窗口。

要記得刷新。

//查看flutter的版本
flutter --version

//查看開發flutter需要的環境
flutter doctor

這裡要提醒一下,如果你是用Z shell的話就是改.zshrc不是改.bash_profile,然後設定路徑就可以。
zsh: command not found: flutter - macOS


輸入flutter doctor後,你可能會看到類似這樣的畫面
這是doctor幫你診斷後給的診對書,只要把上面列表的都弄成綠色勾勾就可以了

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →


如果你的android studio已經確認有安裝Flutter跟Dart的plugin
但是doctor診斷還是有錯的話,那可以在terminal輸入下面這段指令

ln -s ~/Library/Application\ Support/Google/AndroidStudio4.1/plugins ~/Library/Application\ Support/AndroidStudio4.1


影片安裝教學1
影片安裝教學2
影片安裝教學3 - android環境
影片安裝教學4 - ios環境
影片安裝教學5 - ios環境2


參考文章
Flutter 環境建置 (Windows)