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.
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
- For Mac OS: Install Homebrew , and then run the following commands:
$ 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
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.
- Dart Programming - Functions
- Dart Programming - List
- HTML Document Object Model and Dart Programming
- Dart Programming - Map
- Dart Programming - If Else Statement (if , if..else, Nested if, if-else-if)
- How to Combine Lists in Dart?
- Basics of Numbers in Dart
- Dart - Super and This keyword
- Dart - Standard Input Output
- Generators in Dart
- Dart - Classes And Objects
- Operators in Dart
- Dart - Loops
- Switch Case in Dart
- Dart - Loop Control Statements (Break and Continue)
- Instance and class methods in Dart
- Abstract Classes in Dart
- Labels in Dart
- Different Types of Functions in Dart
- Dart - Splitting of String
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.