Basics

Dart Installation

Installing Dart

Dart installation uses Dart SDK or Flutter for development setup.

Prerequisites

Before installing Dart or Flutter, ensure that you have the necessary prerequisites. You need to have a working internet connection and administrative access to your computer to install software packages.

Installing Dart SDK

Dart SDK is essential for developing Dart applications. Follow these steps to install Dart SDK on your system:

Installing on Windows

1. Go to the Dart SDK official download page. 2. Download the Dart SDK installer for Windows. 3. Run the installer and follow the on-screen instructions to complete the installation.

Installing on macOS

1. Open the terminal. 2. Use Homebrew to download and install Dart: brew tap dart-lang/dart brew install dart

Installing on Linux

1. Open the terminal. 2. Use the following commands to download and install Dart:

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'
sudo apt update
sudo apt install dart

Setting Up Environment Variables

After installing Dart SDK, you need to set up environment variables to use Dart from the command line.

On Windows

1. Open System Properties (Right-click on 'This PC' > Properties > Advanced system settings). 2. Click on 'Environment Variables'. 3. Under 'System Variables', find 'Path' and click 'Edit'. 4. Add the path to the Dart SDK (e.g., C:\Program Files\Dart\dart-sdk\bin). 5. Click 'OK' to save changes.

On macOS and Linux

1. Open the terminal. 2. Edit your shell configuration file (e.g., ~/.bashrc, ~/.zshrc, or ~/.profile). 3. Add the following line: export PATH="\$PATH:/usr/lib/dart/bin" 4. Save the file and run source ~/.bashrc or the equivalent for your shell.

Installing Flutter

Flutter is used for building mobile applications with Dart. Here's how you can install Flutter on your system:

Installing Flutter on Windows, macOS, and Linux

1. Visit the official Flutter installation page. 2. Download the Flutter SDK for your operating system. 3. Extract the downloaded file to the desired location on your system. 4. Add the Flutter tool to your path by following the instructions specific to your operating system.

Verifying Installation

After installation, verify that Dart and Flutter are installed correctly by running the following commands in your terminal or command prompt.

If both commands return version information without errors, then your installation is successful.