Programming Languages Section

Dart

Card image
Post by Amina Delali, September 19th,2021

Some Facts

Dart is an object oriented language optimized for user interface creation. It is an open source general-purpose programming language that compiles to native machine code as well as to javascript language. So it can be used to develop apps for any platform. It is also static typed and it allows safe programming. 

Dart core libraries already provide the essentials for many programming tasks. It can be used to develop mobile apps as well as to build servers and desktop applications. Developed and used first by Google, it is now used by other companies as Alibaba , and  WorkTrails.



How to install it

  • on Windows:

    To install Dart on Windows 10, you can do it using chocolatey following the described steps below:

    1. install chocolatey from this  pricing page ( you can install it for free).
    2. open the command prompt then type in and run the following command: choco install dart-sdk
    3. to upgrade the installation, from the command prompt again, type and run the following command: choco upgrade dart-sdk
    4. To be sure to be able to use the dart sdk executables, add the sdk location to your PATH environment variable (the default location is C:\tools\dart-sdk). For more details of how to set this environment variable, you can check the following link.
  • on ubuntu :
    • To install Dart on Ubuntu, just open the terminal and run the following commands: $ 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
    • To check the Dart version, just run the following command: dart --version

In the video below, the details of the installation of the Dartlanguage on Ubuntu.

The Hello World Example

To run your first Hello World Code on Ubuntu, just follow the steps below:

  1. create a new file in the Home folder, and save it under the name “hello.dart”.
  2. write and save the following code in the hello.dart file:
    Copy Code
    void main(){
     print("Hello World!");
    }
  3. to run your code, open the terminal from the Home folder and run the following command: dart hello.dart


Additional Information

For more information about the Dart language and the corresponding code, you can check the following pages:

Something to say ?

If you want to add something about the Dart language or about this post, please feel free to do it by commenting below 🙂 .