Windows

  1. Download the Dart SDK from the official Dart website.
  2. Extract the downloaded ZIP file to a location of your choice, for example, C:\dart.
  3. Update your system’s PATH environment variable:
    • Open the Start Search, type in “env”, and select “Edit the system environment variables”.
    • Click on the “Environment Variables” button.
    • Under “System variables”, find the PATH variable, select it, and click “Edit”.
    • Add the path to the Dart SDK bin directory, for example, C:\dart\dart-sdk\bin.
  4. Open a new command prompt and run dart --version to verify the installation.

macOS

  1. Open a terminal.
  2. Install Homebrew if you haven’t already:
  /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  
  1. Use Homebrew to install Dart:
  brew tap dart-lang/dart
brew install dart
  
  1. Verify the installation by running:
  dart --version
  

Linux

Using apt (Debian-based systems like Ubuntu)

  1. Open a terminal.
  2. Add the Dart APT repository:
  sudo apt update
sudo apt install apt-transport-https
sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
  
  1. Install the Dart SDK:
  sudo apt update
sudo apt install dart
  
  1. Verify the installation:
  dart --version
  

Using yum (RHEL-based systems like CentOS, Fedora)

  1. Open a terminal.
  2. Add the Dart YUM repository:
  sudo tee /etc/yum.repos.d/dart.repo << EOF
[dart]
name=Dart
baseurl=https://storage.googleapis.com/download.dartlang.org/linux/fedora/stable/x86_64/
enabled=1
gpgcheck=1
gpgkey=https://dl-ssl.google.com/linux/linux_signing_key.pub
EOF
  
  1. Install the Dart SDK:
  sudo yum install dart
  
  1. Verify the installation:
  dart --version