Get the Dart SDK
This page describes how to download the Dart SDK. The Dart SDK includes the libraries and command-line tools that you need to develop Dart command-line, server, and web apps.
To learn more about the Dart SDK, consult the Dart SDK overview.
System requirements
#Dart supports the following hardware architectures and platform versions to develop and run Dart code.
Platform | x64 | IA32 (x86) | Arm32 | Arm64 | RISC-V (RV64GC) | OS Versions |
---|---|---|---|---|---|---|
Windows | verified | error | dangerous | verified | do_not_disturb_on | 10, 11 |
Linux | verified | error | verified | verified | verified | Debian stable, Ubuntu LTS under standard support |
macOS | verified | dangerous | do_not_disturb_on | verified | do_not_disturb_on | Latest three versions of macOS: Sonoma (14), Ventura (13), Monterey (12) |
verified Supported on all channels.
error Support is deprecated and might be dropped in a future Dart release.
dangerous Unsupported on all channels.
do_not_disturb_on Unsupported by the operating system.
Choose an installation option
#To install and update the Dart SDK from the stable channel, choose one of the following options:
-
Use a package manager (Recommended).
-
Use a Dart Docker image.
-
Install Flutter.
If you've installed or plan to install the Flutter SDK, it includes the full Dart SDK. The Flutter SDK includes thedart
CLI tool in Flutter'sbin
folder. -
Download a ZIP archive from the SDK Archive.
Install the Dart SDK
#To install the Dart SDK, use the appropriate package manager for your development platform.
To upgrade the Dart SDK, run the same command to install the Dart SDK from your package manager.
Install using Chocolatey
#To install the Dart SDK, use Chocolatey. Chocolatey requires elevated permissions.
-
Install Chocolatey.
-
Launch PowerShell with elevated permissions.
PS C:\> choco install dart-sdk
Change default install path
#By default, Chocolatey installs the SDK at C:\tools\dart-sdk
.
To change that location, set the ChocolateyToolsLocation
environment variable to your desired installation directory.
Verify your PATH includes Dart
#Verify you can run Dart.
PS C:\> dart --version
Dart SDK version: 3.2.4 (stable) (Thu Dec 21 19:13:53 2023 +0000) on "win_x64"
If your development machine doesn't return a Dart version, add the SDK location to your PATH:
- In the Windows search box, type
env
. - Click Edit the system environment variables.
- Click Environment Variables....
- In the user variable section, select Path and click Edit....
- Click New, and enter the path to the
dart-sdk
directory. - In each window that you just opened, click Apply or OK to dismiss it and apply the path change.
Upgrade using Chocolatey
#To upgrade the Dart SDK, use the following command.
PS C:\> choco upgrade dart-sdk
Uninstall using Chocolatey
#To uninstall the Dart SDK, perform the following steps.
-
Launch PowerShell with elevated permissions.
-
Use the following command.
PS C:\> choco uninstall dart-sdk
-
Remove the Dart configuration files from your home directory.
PS C:\> Remove-Item -Recurse -Force ^ -Path $env:LOCALAPPDATA\.dartServer,$env:APPDATA\.dart,$env:APPDATA\.dart-tool
Install using a Linux package manager
#You have two options to install the Dart SDK on Ubuntu or Debian:
Install using the apt-get
package manager
#To install Dart with apt-get
, perform the following steps.
You need steps 1 to 3 only for the first install.
-
Update the package index files and install the secure HTTP package.
$ sudo apt-get update && sudo apt-get install apt-transport-https
-
Download and add the Google Linux GPG public key.
$ wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub \ | sudo gpg --dearmor -o /usr/share/keyrings/dart.gpg
-
Add the Dart package repository to your Linux system.
$ echo 'deb [signed-by=/usr/share/keyrings/dart.gpg arch=amd64] https://storage.googleapis.com/download.dartlang.org/linux/debian stable main' \ | sudo tee /etc/apt/sources.list.d/dart_stable.list
-
Use the following
sudo apt-get
commands.$ sudo apt-get update && sudo apt-get install dart
Install as a Debian package
#To install the Dart SDK as a Debian package (*.deb
),
perform the following steps.
-
Download the Dart SDK Debian package.
-
Use the
sudo dpkg
command to install the*.deb
package.$ sudo dpkg -i dart_3.4.0-1_amd64.deb
Substitute
dart_3.4.0-1_amd64.deb
with the current filename.
Upgrade the Dart SDK
#Use the same command that you used to install the SDK.
Upgrade using apt-get
#If you installed the Dart SDK with apt-get
,
use the following sudo apt-get
commands.
$ sudo apt-get update && sudo apt-get install dart
Upgrade using dpkg
#If you installed the Dart SDK with dpkg
,
use the sudo dpkg
command.
$ sudo dpkg -i dart_3.2.6-1_amd64.deb
Substitute dart_3.4.0-1_amd64.deb
with the new upgrade's filename.
Uninstall the Dart SDK
#Uninstall using apt-get
#If you installed the Dart SDK with apt-get
,
use the sudo apt-get remove
command.
-
Use the
sudo apt-get remove
command.$ sudo apt-get remove -y dart
-
Remove the Dart configuration files from your home directory.
$ rm -rf ~/.dart*
Uninstall using dpkg
#If you installed the Dart SDK with dpkg
,
use the sudo dpkg --purge
command.
-
Use the
sudo dpkg --purge
command.$ sudo dpkg --purge dart
This removes the configuration files at the same time.
-
Verify the SDK has been removed.
$ dpkg -l | grep dart
Install using Homebrew
#To install the Dart SDK, use Homebrew.
-
Install Homebrew if needed.
-
Add the official tap.
$ brew tap dart-lang/dart
-
Install the Dart SDK.
$ brew install dart
Verify PATH includes Homebrew
#Verify that your PATH
includes the Homebrew bin
directory.
Setting up the correct path simplifies using Dart SDK commands
such as dart run
and dart format
.
To get help configuring your PATH
, consult the Homebrew FAQ.
Upgrade using Homebrew
#To upgrade when a new release of Dart is available:
$ brew upgrade dart
Switch Dart versions
#To switch between locally installed Dart releases:
-
Install the version to which you want to switch.
For example, to install Dart 3.1:
$ brew install [email protected]
-
To switch between versions, unlink the current version and link the desired version.
$ brew unlink dart@<old> \ && brew unlink dart@<new> \ && brew link dart@<new>
List installed Dart versions
#To see which versions of Dart you've installed:
$ brew info dart
Uninstall using Homebrew
#To uninstall the Dart SDK, use Homebrew.
-
Uninstall the Dart SDK.
$ brew uninstall dart
-
Remove the Dart configuration files from your home directory.
dartrm -rf ~/.dart*
Release channel reference
#Stable channel
#Dart publishes a new release to the stable channel about every three months.
The current stable version is [calculating]
.
Use stable channel releases for building and deploying production apps.
Stable channel release version strings follow a x.y.z
format:
x
: major versiony
: minor versionz
: patch version
Examples of stable channel version strings include 1.24.3
and 2.1.0
.
To install a stable channel release, follow the instructions on this page.
Beta channel
#Dart publishes a new release to the beta channel about once a month.
The current beta version is [calculating]
.
Use beta channel releases for testing your app's compatibility with future stable versions.
Beta channel release version strings follow a x.y.z-a.b.beta
format:
x
: major versiony
: minor versionz
: patch versiona
: pre-release versionb
: pre-release patch version
Examples of beta channel version strings include 2.8.0-20.11.beta
and 3.3.0-205.1.beta
.
To install a beta channel release, download the SDK as a zip file.
Dev channel
#Dart publishes a new release to the dev channel about twice a week.
The current dev version is [calculating]
.
Use dev channel releases for testing recent fixes and experimental features.
Dev channel release version strings follow a x.y.z-a.b.dev
format:
x
: major versiony
: minor versionz
: patch versiona
: development versionb
: development patch version
Examples of dev channel version strings include 2.8.0-20.11.dev
and 3.2.12-15.33.dev
.
除非另有说明,文档之所提及适用于 Dart 3.5.4 版本,本页面最后更新时间: 2024-08-06。 查看文档源码 或者 报告页面问题。