Dart Installation

Dart Installation

To learn the Dart, we need to set up the Dart programming environment to our local machine. We are describing the following instructions to install the Dart SDK (Software Development Kit) in various operating systems. If you have already installed it, then you can skip this part.

Install the Dart SDK on Windows

Follow the below instructions to install Dark SDK in Windows

.

Step -1: Go to the browser and type the following link to download the SDK.

http://www.gekorm.com/dart-windows/

Dart Installation

Step - 2: Run the Dart installer(It is the .exe file that we downloaded in the previous step) and click on the Next button.

Dart Installation

Step - 3: It provides the option to select the Dart installation path. After the path is selected, click on the Next button.

Dart Installation
Dart Installation

Step - 4: After the download is completed, set the PATH environment variable to "C:\Program Files\Dart\dart-sdk\bin" in advance system properties.

Dart Installation

Step - 5: Now open the terminal and verify the Dart installation by typing dart.

Dart Installation

If it is successfully installed then it looks like the above image.

Install the Dart SDK on Linux

The steps of Dart installation on Linux

is given below.

Before installing the Dart

, if you are Debian/Ubuntu on AMD64(64-bit Intel) in your local machine, you can install the Dart through one of the following options.

  • Install using apt-get
  • Install a Debian package

Installation using apt-get

Step -1: Type the following commands for a one-time setup.

  1. $sudo apt-get update  
  2. $ sudo apt-get install apt-transport-https  
  3.   
  4. $ sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'  
  5.   
  6. $ 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'  

Step - 2: Type the following command in terminal to install the Dart SDK using apt-get option.

  1. $sudo apt-get update  
  2. $ sudo apt-get install dart  

It will successfully download the Dart SDK.

Installation a Debian Package

We can download Dart SDK as a Debian package in the .deb package format. To make all Dart binaries accessible, we have to change the PATH by typing the following command.

  1. export PATH="$PATH:/usr/lib/dart/bin"  

To change the PATH for upcoming terminal sessions, use a below command:

  1. $ echo 'export PATH="$PATH:/usr/lib/dart/bin"' >> ~/.profile  

Install the Dark SDK on Mac

Step -1: We should have Homebrew package manager, but if we don't have it then install the Homebrew and run the following command. It will successfully download the Dart on the Mac.

  1. $brew tap dart-lang/dart  
  2. $ brew install dart  

Step -2: To verify which version we have installed, use the following command.

  1. $brew info dart  

Online Dart Editor

We have discussed Dark installation on the various operating systems so far, but if we do not want to install Dart then there is an online Dark editor (Known as DartPad) is available to run the Dark programs. The online DartPad is provided at https://dartpad.dev/

. The DartPad offers to execute the dart scripts and display HTML

and also console output. The online DartPad looks like the below image.

Dart Installation

Dart IED Support

The Eclipse, IntelliJ

, and WebStorm are the IDEs from the Jet brains that support the Dart Programming, but WebStorm is more popular than others. We can download it from https://www.jetbrains.com/webstorm/download/#section=windows-version.

The dart2js Tool

The Dark SDK comes with the dart2js tool, which transmits the Dart code into runnable JavaScript

code. It is necessary because few web browsers do not support the Dart VM.

Use the following command in the terminal to compile the Dart code into JavaScript code.

  1. dart2js - - out = <output_file>.js  <dart_script>.dart  

The above command will create a file that contains the JavaScript code corresponding to the Dart code

Comments