You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何安装Dart v2?遍查官方文档无果求助

How to Install Dart v2 (Stable/Dev Channel) for AngularDart

Hey there! I totally get how frustrating it is to dig through the Dart docs looking for installation steps when they seem to gloss over the obvious stuff. Let me walk you through exactly how to get Dart v2 (either stable or dev channel) set up—since you need it for those AngularDart components.

First, quick recap on the channels to make sure we're on the same page:

  • Stable channel: The most reliable, thoroughly tested version—perfect for production or consistent development work
  • Dev channel: Cutting-edge features, but might have occasional bugs—great if you need the latest tools for testing

Step 1: Pick Your Installation Method

Option 1: Manual SDK Download (Works for All Platforms)

This is straightforward and gives you full control:

  1. Navigate to the Dart SDK download section (it’s usually under the "Get Dart" menu on the official site—easy to miss at first!)
  2. Select either Stable or Dev from the channel dropdown
  3. Download the package matching your OS:
    • Windows: .zip file
    • macOS/Linux: .tar.gz file
  4. Extract the downloaded file to a permanent location on your computer (e.g., C:\dart-sdk for Windows, /usr/local/dart-sdk for macOS/Linux)
  5. Add the bin folder inside the extracted SDK directory to your system’s PATH:
    • Windows: Open System Properties → Advanced → Environment Variables, find the Path variable, and add the full path to dart-sdk\bin (like C:\dart-sdk\bin)
    • macOS/Linux: Open your terminal config file (~/.bashrc, ~/.zshrc, or ~/.profile), add export PATH="$PATH:/usr/local/dart-sdk/bin", then run source ~/.zshrc (or your respective file) to apply the change right away

Option 2: Package Managers (Simpler for Updates)

If you prefer automated installs and easy updates, use these platform-specific tools:

  • macOS (Homebrew):
    • Stable channel: Run brew install dart in your terminal
    • Dev channel: Run brew install dart --head
  • Windows (Chocolatey):
    • Open Command Prompt as administrator
    • Stable channel: choco install dart-sdk
    • Dev channel: choco install dart-sdk --pre
  • Linux (Debian/Ubuntu):
    1. First, run sudo apt-get update && sudo apt-get install apt-transport-https to enable secure repo access
    2. Add the Dart repo: For stable, run sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/dart.gpg] https://dl.dartlang.org/linux/debian stable main" > /etc/apt/sources.list.d/dart_stable.list'
      • For dev channel, replace stable with dev in the line above
    3. Install the SDK: sudo apt-get update && sudo apt-get install dart

Step 3: Verify Your Installation

Open a brand new terminal or Command Prompt window (old windows might not pick up PATH changes) and run:

dart --version

You should see a version number starting with 2.x.x or higher—exactly what you need for AngularDart components.


Quick Tip: Switching Channels Later

If you ever want to switch between stable and dev versions:

  • Manual install: Just download the SDK for your desired channel, replace your existing SDK directory, and double-check your PATH is pointing to the new folder
  • Package manager: Use the update command for the target channel (e.g., brew upgrade dart --head for dev on macOS, choco upgrade dart-sdk --pre for Windows)

A quick heads-up: AngularDart components do require Dart v2 or later, so if you run into build errors after installing, double-check your PATH—sometimes old SDK versions can linger and cause conflicts.

内容的提问来源于stack exchange,提问作者Dean Chalk

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 10:07:12