How to setup Dart SDK including the compiler and other tools on Ubuntu 16.04/14.04

As you might already be aware Dart is the hottest new language in the programming space backed by none other than Google. The Dart team at Google has worked over several years to create the language which at initial impressions may seem like a mix of JavaScript, Java and C++ but is quite powerful in its ability to be compiled to native code for cross platform applications.

In this post we will start by installing the necessary dependencies for dart and then install the Dart compiler, after that we will install dart tools.

As of the this post the current version of Dart is 2.0 and the installation steps are for version 2.0 and its minor versions.

Install Dart via the command line / terminal.

Head over to your computer and start a terminal (CTRL + ALT + T) session, issue the following commands :

sudo apt-get update

Install the dependencies

sudo apt-get install apt-transport-https -y

Install the apt source path for future upgrades to your system

sudo sh -c 'curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
sudo sh -c 'curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'

Now lets install the Dart SDK:

sudo apt-get update && sudo apt-get install dart -y

Check if dart is installed successfully

> dart --version
You should now see a version on the command line for dart

Thats all ! Dart is successfully installed on your system. Optionally, if you would like the Dart compiler to be available via the command line then please add the two lines below to your $HOME/.bashrc file.

export PUB_HOME=/usr/lib/dart/bin
export PATH=$PATH:$PUB_HOME

Lets check if the environment variables are installed correctly, run the following commands :

> exec bash

This will reload the shell with the changes in .bashrc

Now you can use the command line tools by opening your favourite terminal application and running dart. Finally, dart is now installed on your Linux (Ubuntu) computer.

Official Dart  Link : https://www.dartlang.org/tools/sdk

If you would like to setup and IDE to program in Dart to create websites or apps you can try out the Intellij IDE which is compatible with the dart compiler plugin. The next post describes the install process for Intellj IDEA Development Environment and the Dart plugin.

Related posts

Leave a Comment