Dart is Object-oriented language and is quite similar to that of Java Programming. Dart is extensively use to create single-page websites and web-applications. Best example of dart application is Gmail.
You can install Dart SDK from their official website or download the installer from this site.
For Windows OS:
To install dart in window system we will be using Chocolatey.
To install Dart:
C:\> choco install dart-sdk
To Update Dart:
C:\> choco upgrade dart-sdk
For Linux OS:
If you’re using Debian/Ubuntu on AMD64 (64-bit Intel), you can choose one of the following options, both of which can update the SDK automatically when new versions are released.
Install using apt-get:
Perform the following one-time setup:
$ sudo apt-get update
$ sudo apt-get 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'
Then install the Dart SDK:
$ sudo apt-get update
$ sudo apt-get install dart
Install a Debian package:
Download Dart SDK as Debian package in the .deb package format.
Modify PATH for access to all Dart binaries
After installing the SDK, add its bin directory to your PATH. For example, use the following command to change PATH in your active terminal session:
$ export PATH="$PATH:/usr/lib/dart/bin"
To change the PATH for future terminal sessions, use a command like this:
$ echo 'export PATH="$PATH:/usr/lib/dart/bin"' >> ~/.profile
$ brew tap dart-lang/dart
$ brew install dart
To upgrade when a new release of Dart is available:
$ brew upgrade dart
First Code in Dart:
In dart main() function is predefined method and acts as the entry point to the application. A dart script needs the main() method for execution of the code. The program code goes like this:
"Welcome to GeeksForGeeks"
Welcome to GeeksForGeeks
The print() command is predefined function that prints the specific string or value to the standard input.
Execution of program:
- Online Compiler: The online compiler which support Dart is Dart Pad.
- IDE: The IDEs which support Dart are WebStorm, Intellij, Eclipse, etc. Among them WebStorm from Jetbrains is available for Mac OS, Windows and Linux.
- The dart program can also be compile through terminal by executing the code dart file_name.dart.