Introduction to Dart Programming Language

Hello Flutter Programmers. Welcome back to my blogger. In this flutter tutorial I am going to discuss the main programming language in flutter language. It is Dart. Dart is the programming language used to code flutter apps. Dart programming language is another product by Google. So let’s start ‘Introduction to Dart Programming Language” article. If you want to check my “Introduction to Flutter Programming” article, click here.

What is Dart Programming Language

Dart is a client-optimized an open-source, general-purpose, Object oriented, Strongly Typed, Garbage-collected programming language for apps on multiple platforms. It is developed by Google and is used to build mobile, desktop, backend and web applications.

When we consider about the Dart history, Dart was unveiled at the GOTO conference in Aarhus, Denmark, October 10–12, 2011 was founded by Lars Bak and Kasper Lund. Dart 1.0 was released on November 14th, 2013.

We can use Dart for Mobile Application Development using Flutter. Also for the Web development, server side we can use Dart. Using various libraries and frameworks can make Server side development.

What are the DART features

Main feature is this is optimized for UIs. Because this is a programming language that is easy to learn with a familiar syntax.

In the Productivity side, This is using hot reload to see the results instantly in your running app and we can write code using a flexible type system with rich static analysis and powerful, configurable tooling. Do profiling, logging, and debugging with your code editor of choice. That is why I said this has a productivity development feature.

This is fast on all platform. this compile to ARM and x64 machine code for mobile, desktop and backend or compile to JavaScript for the web. Dart can also be Just in use compiled for exceptionally fast development cycles. Also Dart makes it easier to create smooth animations and transitions that run at 60fps.

Flutter and Dart Language

Dart Installation

First you have to install the DART SDK. click here to download SDK installer for windows. Follow the instructions given in the Dart page. SDK is support for Android studio, IntelliJ Idea, Emacs, Vim, VS code, Atom, Eclipse.

Get into Dart

As you know, Dart is an optionally typed language. It has data types. Let’s discuss what are the data types in Dart programming language.

  • Numbers – Int and double
  • Strings – String keyword is used to represent
  • Booleans – Use bool to represent
  • Lists – Ordered group of objects and it is synonymous to the concept of an array in other programming languages. List
  • Maps – set of values as key-value pairs. Map
  • Dynamic – If the type of a variable is not explicitly specified, the variable’s type is dynamic.

Let’s start Dart Programming.

Here is the simple code.

void main(){
  int a;
  a = 5;
  print(' Value is for A is $a ');

In here just declare a variable and assign some value to that variable. Also in here you can see the print method. It’s simple. Here is the another code with the simple variables.

void main(){
  String name = "BuildITMasters";
  print( 'My name is $name' );
void main(){
  double b = 12.76;
  print( 'Value is : $b ' );

let’s get into some little bit advanced code. Take a look at this code.

void main(){
  var a;
  a = 12;
  print( 'First A value is: $a' );

  a = "BuildITMasters";
  print( 'Second A value is: $a' );

  a = 12.45;
  print( 'Third A value is: $a' );

  a = true;
  print( 'Fourth A value is: $a' );

Copy this code and run. You can code via online editor called Run your code in there and you can see the outputs. Here is the outputs.

  • First A value is: 12
  • Second A value is: BuildITMasters
  • Third A value is: 12.45
  • Third A value is: true

Creating another method…

Refer the below code. you can get an idea about the creating another method in dart programming.

addNumbers( int a, int b){
  return a + b;

void main(){
  int a = 12;
  int b = 12;
  var total = addNumbers(a, b);
  print( 'Total is: $total' );

Creating a Class in Introduction to Dart Programming Language

Here is the code to define a Class in Dart programming. Please refer this code.

class Car{
  String Color.brand;

  String method(){
     return "Method is called";

void main(){
  var myObj = new Car();
  myObj.color = "red";
  myObj.brand = "Lambo";
  print( 'myObj.color' );
  print( 'myObj.brand ' );
  print( 'myObj.method' );

Okay. you have another assignment. Copy this code and run. Use DartPad to run it. you can see the following outputs are in your console.

  • red
  • Lambo
  • Method is called

Dart input output handling

we are going to read number from the user and print that value is a negative or a zero or a positive value. follow the below code.

Control Flow Statements

Using Labels to Control the Flow

A label is simply an identifier followed by a colon (:) that is applied to a statement or a block of code and can be used with break and continue to control the flow more precisely. But Line breaks are not allowed between the ‘continue’ or ‘break’ statement and its label name. Also, there should not be any other statement in between a label name and an associated loop.

Collections Lists in Dart Programming

The dart:core library provide the list class. Dart represents arrays in the form of List objects. A List is simply an ordered group of objects.

We can divide Lists as two types in Dart.

  • Fixed Length List
  • Growable List

Let’s see one by one.

1. Fixed Length List

Refer this example.

var list_name = new List(initial_size)
lst_name[index] = value;

W have to use list for a initial size.

2. Growable List

Refer this example. This example for creates a list containing the specified values.

var list_name = [val1,val2,val3]

This example for creates a list of size zero.

var list_name = new List()

I think that’s enough for basics in Dart Programming. Thank you very much for your valuable time. Make sure to leave a comment.

Thank you for reading. If you are interesting on my article, make sure to follow my other articles as well. Make sure to leave a comment.

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x