命令行
brew tap dart-lang/dart
brew install dart
手动
<stable|beta|dev>:稳定版|beta|开发版
<version>:直接点击https://dart.dev,官网首页里最上面就有最新的稳定版本直接填进去就可了
例如Mac:https://storage.googleapis.com/dart-archive/channels/stable/release/2.8.2/sdk/dartsdk-macos-x64-release.zip
https://storage.googleapis.com/dart-archive/channels/<stable|beta|dev>/release/<version>/sdk/dartsdk-<platform>-<architecture>-release.zip
根据不同平台选择即可下载
https://storage.googleapis.com/dart-archive/channels/stable/release/2.8.2/sdk/dartsdk-windows-ia32-release.zip
https://storage.googleapis.com/dart-archive/channels/stable/release/2.1.1/sdk/dartsdk-macos-x64-release.zip
https://storage.googleapis.com/dart-archive/channels/beta/release/2.8.0-20.11.beta/sdk/dartsdk-linux-x64-release.zip
https://storage.googleapis.com/dart-archive/channels/dev/release/2.9.0-1.0.dev/sdk/dartsdk-linux-x64-release.zip
下载完之后,
到~/.bash_file目录下
将下面填入,将/Users/damo/dart-sdk/bin换成你自己dart-sdk的目录
export DART_HOME=/Users/damo/dart-sdk/bin
export PATH="${DART_HOME}:${PATH}"
之后保存执行
source ~/.bash_profile
运行验证一下就OK了
yuntai@yuntaideMacBook-Pro ~ % dart --version
Dart VM version: 2.8.2 (stable) (Mon May 11 15:06:42 2020 +0200) on "macos_x64"
yuntai@yuntaideMacBook-Pro ~ %