手動安裝 Flutter
學習如何安裝並手動設定 你的 Flutter 開發環境。
選擇你的開發平台
#本頁說明內容以在 Windows 裝置上 安裝 Flutter 為主。
如果你想參考其他作業系統的安裝說明, 請選擇下列其中一項。
下載必要軟體
#在安裝 Flutter SDK(Flutter 軟體開發套件)之前, 請先完成以下設定步驟。
安裝 Git for Windows
下載並安裝最新版的 Git for Windows。
若需要安裝或疑難排解 Git, 請參考 Git 文件。
設定編輯器或 IDE
為獲得最佳的 Flutter 應用程式開發體驗, 建議安裝並設定 支援 Flutter 的編輯器或 IDE。
安裝 Xcode 命令列工具
下載 Xcode 命令列工具以取得 Flutter 依賴的命令列工具(包含 Git)。
若要下載這些工具,請在你偏好的終端機中執行下列指令:
xcode-select --install如果你尚未安裝這些工具, 系統會跳出一個對話視窗,確認你是否要安裝它們。 請點選 Install(安裝),安裝完成後再點選 Done(完成)。
設定編輯器或 IDE
為了獲得最佳的 Flutter 應用程式開發體驗, 建議你安裝並設定一個 支援 Flutter 的編輯器或 IDE。
下載並安裝必要的套件
請使用你偏好的套件管理工具或安裝方式, 安裝下列套件的最新版本:
curlgitunzipxz-utilsziplibglu1-mesa
在以
apt-get為基礎的 Debian 發行版(如 Ubuntu)上, 請使用以下指令安裝這些套件:sudo apt-get update -y && sudo apt-get upgrade -y sudo apt-get install -y curl git unzip xz-utils zip libglu1-mesa設定編輯器或 IDE
為了獲得最佳的 Flutter 應用程式開發體驗, 建議安裝並設定 支援 Flutter 的編輯器或 IDE。
設定 Linux 支援
如果你之前尚未在 Chromebook 上設定 Linux 支援, 請參考 開啟 Linux 支援。
如果你已經開啟了 Linux 支援, 請依照 修正 Linux 問題 的指示,確保其為最新狀態。
下載並安裝必要套件
使用
apt-get或你偏好的安裝方式, 安裝下列套件的最新版本:curlgitunzipxz-utilsziplibglu1-mesa
如果你想使用
apt-get, 請使用下列指令安裝這些套件:sudo apt-get update -y && sudo apt-get upgrade -y sudo apt-get install -y curl git unzip xz-utils zip libglu1-mesa設定編輯器或 IDE
為了獲得最佳的 Flutter 應用程式開發體驗, 建議安裝並設定 支援 Flutter 的編輯器或 IDE。
安裝並設定 Flutter
#要安裝 Flutter SDK(Flutter 軟體開發套件), 請從 SDK 歷史版本存檔下載最新的安裝包, 然後將 SDK 解壓縮到你希望儲存的位置。
下載 Flutter SDK 安裝包
下載以下安裝包以取得 最新穩定版的 Flutter SDK。
建立儲存 SDK 的資料夾
建立或尋找一個資料夾來儲存解壓縮後的 SDK。 建議在
%USERPROFILE%\develop(C:\Users\{username}\develop)建立並使用一個目錄。解壓縮 SDK
將你下載的 SDK 安裝包 解壓縮到你想儲存 Flutter SDK 的目錄中。
- 複製以下指令。
- 將
<sdk_zip_path>替換為你下載的安裝包路徑。 - 將
<destination_directory_path>替換為你希望解壓縮後 SDK 所在的資料夾路徑。 - 在你偏好的終端機中執行已編輯的指令。
Expand-Archive –Path <sdk_zip_path> -Destination <destination_directory_path>例如,如果你已將 Flutter 3.29.3 的 bundle 檔案下載到
%USERPROFILE%\Downloads目錄,並希望將解壓後的 SDK 儲存到%USERPROFILE%\develop目錄:Expand-Archive ` -Path $env:USERPROFILE\Downloads\flutter_windows_3.29.3-stable.zip ` -Destination $env:USERPROFILE\develop\
下載 Flutter SDK 套件
根據您的 macOS 裝置 CPU 架構,請下載下列其中一個安裝套件,以取得最新版穩定版的 Flutter SDK。
Apple Silicon (ARM64) Intel (x64) (loading...) (loading...) 建立儲存 SDK 的資料夾
請建立或尋找一個資料夾,用來存放解壓縮後的 SDK。建議您在
~/develop/建立並使用一個目錄。解壓縮 SDK
將您下載的 SDK 套件解壓縮到您希望存放 Flutter SDK 的目錄中。
- 複製下方指令。
- 將
<sdk_zip_path>替換為您下載的套件檔案路徑。 - 將
<destination_directory_path>替換為您希望解壓縮後 SDK 所在的資料夾路徑。 - 在您偏好的終端機中執行編輯後的指令。
unzip <sdk_zip_path> -d <destination_directory_path>例如,假設你已將 Flutter 3.29.3 的 bundle 檔案下載到
~/Downloads目錄,並希望將解壓縮後的 SDK 儲存在~/develop目錄:unzip ~/Downloads/flutter_macos_3.29.3-stable.zip -d ~/develop/
下載 Flutter SDK 套件
下載以下安裝套件,以取得最新穩定版本的 Flutter SDK(Flutter 軟體開發套件)。
建立儲存 SDK 的資料夾
建立或尋找一個資料夾,用來存放解壓縮後的 SDK。 建議在
~/develop/目錄下建立並使用該資料夾。解壓縮 SDK
將你下載的 SDK 套件解壓縮到你想要存放 Flutter SDK 的目錄中。
- 複製以下指令。
- 將
<sdk_zip_path>替換為你下載的套件檔案路徑。 - 將
<destination_directory_path>替換為你希望解壓縮後 SDK 所在的資料夾路徑。 - 在你偏好的終端機中執行編輯後的指令。
tar -xf <sdk_zip_path> -C <destination_directory_path>例如,假設你已將 Flutter 3.29.3 的 bundle 檔案下載到
~/Downloads目錄,並希望將解壓縮後的 SDK 儲存到~/develop目錄:tar -xf ~/Downloads/flutter_linux_3.29.3-stable.tar.xz -C ~/develop/
將 Flutter 加入您的 PATH
#現在您已下載好 SDK, 請將 Flutter SDK 的 bin 目錄加入您的 PATH 環境變數中。 將 Flutter 加入您的 PATH 之後,您就能在終端機與 IDE 中 使用 flutter 和 dart 命令列工具。
Determine your Flutter SDK installation location
Copy the absolute path to the directory that you downloaded and extracted the Flutter SDK into.
Navigate to the environment variables settings
Press Windows + Pause.
If your keyboard lacks a Pause key, try Windows + Fn + B.
The System > About dialog opens.
Click Advanced System Settings > Advanced > Environment Variables....
The Environment Variables dialog opens.
Add the Flutter SDK bin to your path
In the User variables for (username) section of the Environment Variables dialog, look for the Path entry.
If the Path entry exists, double-click it.
The Edit Environment Variable dialog should open.
Double-click inside an empty row.
Type the path to the
bindirectory of your Flutter installation.For example, if you downloaded Flutter into a
develop\flutterfolder inside your user directory, you'd type the following:%USERPROFILE%\develop\flutter\binClick the Flutter entry you added to select it.
Click Move Up until the Flutter entry sits at the top of the list.
To confirm your changes, click OK three times.
If the entry doesn't exist, click New....
The Edit Environment Variable dialog should open.
In the Variable Name box, type
Path.In the Variable Value box, type the path to the
bindirectory of your Flutter installation.For example, if you downloaded Flutter into a
develop\flutterfolder inside your user directory, you'd type the following:%USERPROFILE%\develop\flutter\binTo confirm your changes, click OK three times.
Apply your changes
To apply this change and get access to the
fluttertool, close and reopen all open command prompts, sessions in your terminal apps, and IDEs.Validate your setup
To ensure you successfully added the SDK to your
PATH, open command prompt or your preferred terminal app, then try running theflutteranddarttools.flutter --version dart --versionIf either command isn't found, check out Flutter installation troubleshooting.
Determine your Flutter SDK installation location
Copy the absolute path to the directory that you downloaded and extracted the Flutter SDK into.
Open or create the Zsh environment variable file
If it exists, open the Zsh environment variable file
~/.zprofilein your preferred text editor. If it doesn't exist, create the~/.zprofilefile.Add the Flutter SDK bin to your path
At the end of your
~/.zprofilefile, use the built-inexportcommand to update thePATHvariable to include thebindirectory of your Flutter installation.Replace
<path-to-sdk>with the path to your Flutter SDK installation.bashexport PATH="<path-to-sdk>/bin:$PATH"For example, if you downloaded Flutter into a
develop/flutterfolder inside your user directory, you'd add the following to the file:bashexport PATH="$HOME/develop/flutter/bin:$PATH"Save your changes
Save, then close, the
~/.zprofilefile you edited.Apply your changes
To apply this change and get access to the
fluttertool, close and reopen all open Zsh sessions in your terminal apps and IDEs.Validate your setup
To ensure you successfully added the SDK to your
PATH, open a Zsh session in your preferred terminal, then try running theflutteranddarttools.flutter --version dart --versionIf either command isn't found, check out Flutter installation troubleshooting.
Determine your Flutter SDK installation location
Copy the absolute path to the directory that you downloaded and extracted the Flutter SDK into.
Determine your default shell
If you don't know what shell you use, check which shell starts when you open a new console window.
echo $SHELLAdd the Flutter SDK bin to your path
To add the
bindirectory of your Flutter installation to yourPATH:- Expand the instructions for your default shell.
- Copy the provided command.
- Replace
<path-to-sdk>with the path to your Flutter SDK install. - Run the edited command in your preferred terminal with that shell.
Expand for
bashinstructionsecho 'export PATH="<path-to-sdk>:$PATH"' >> ~/.bash_profileFor example, if you downloaded Flutter into a
develop/flutterfolder inside your user directory, you'd run the following:echo 'export PATH="$HOME/develop/flutter/bin:$PATH"' >> ~/.bash_profileExpand for
zshinstructionsecho 'export PATH="<path-to-sdk>/bin:$PATH"' >> ~/.zshenvFor example, if you downloaded Flutter into a
develop/flutterfolder inside your user directory, you'd run the following:echo 'export PATH="$HOME/develop/flutter/bin:$PATH"' >> ~/.zshenvExpand for
fishinstructionsfish_add_path -g -p <path-to-sdk>/binFor example, if you downloaded Flutter into a
develop/flutterfolder inside your user directory, you'd run the following:fish_add_path -g -p ~/develop/flutter/binExpand for
cshinstructionsecho 'setenv PATH "<path-to-sdk>/bin:$PATH"' >> ~/.cshrcFor example, if you downloaded Flutter into a
develop/flutterfolder inside your user directory, you'd run the following:echo 'setenv PATH "$HOME/develop/flutter/bin:$PATH"' >> ~/.cshrcExpand for
tcshinstructionsecho 'setenv PATH "<path-to-sdk>/bin:$PATH"' >> ~/.tcshrcFor example, if you downloaded Flutter into a
develop/flutterfolder inside your user directory, you'd run the following:echo 'setenv PATH "$HOME/develop/flutter/bin:$PATH"' >> ~/.tcshrcExpand for
kshinstructionsecho 'export PATH="<path-to-sdk>/bin:$PATH"' >> ~/.profileFor example, if you downloaded Flutter into a
develop/flutterfolder inside your user directory, you'd run the following:echo 'export PATH="$HOME/develop/flutter/bin:$PATH"' >> ~/.profileExpand for
shinstructionsecho 'export PATH="<path-to-sdk>/bin:$PATH"' >> ~/.profileFor example, if you downloaded Flutter into a
develop/flutterfolder inside your user directory, you'd run the following:echo 'export PATH="$HOME/develop/flutter/bin:$PATH"' >> ~/.profileApply your changes
To apply this change and get access to the
fluttertool, close and reopen all open shell sessions in your terminal apps and IDEs.Validate your setup
To ensure you successfully added the SDK to your
PATH, open your preferred terminal with your default shell, then try running theflutteranddarttools.flutter --version dart --versionIf either command isn't found, check out Flutter installation troubleshooting.
Determine your Flutter SDK installation location
Copy the absolute path to the directory that you downloaded and extracted the Flutter SDK into.
Add the Flutter SDK bin to your path
To add the
bindirectory of your Flutter installation to yourPATH:- Copy the following command.
- Replace
<path-to-sdk>with the path to your Flutter SDK install. - Run the edited command in your preferred terminal.
echo 'export PATH="<path-to-sdk>:$PATH"' >> ~/.bash_profileFor example, if you downloaded Flutter into a
develop/flutterfolder inside your user directory, you'd run the following:echo 'export PATH="$HOME/develop/flutter/bin:$PATH"' >> ~/.bash_profileApply your changes
To apply this change and get access to the
fluttertool, close and reopen all open Zsh sessions in your terminal apps and IDEs.Validate your setup
To ensure you successfully added the SDK to your
PATH, open a Zsh session in your preferred terminal, then try running theflutteranddarttools.flutter --version dart --versionIf either command isn't found, check out Flutter installation troubleshooting.
繼續您的 Flutter 之旅
#現在您已成功安裝 Flutter, 請至少設定一個目標平台的開發環境, 以繼續您的 Flutter 之旅。

