Dart For Flutter Beginner (Part-1)

Image for post
Image for post


  1. What is Dart
  2. Dart’s Hello World!
  4. Operators
  5. Control Flow
  1. Basic Data Types
  2. Complex Data Types
  3. Dynamic Data Type
  4. Final & Const
  1. Basic Functions
  2. Types of functions
  3. Scope
  1. Classes
  2. Constructors
  3. Inheritance
  4. Enums

Part 1: Introduction To Dart

1. What Is Dart

Dart is a client-optimized programming language for fast apps on multiple platforms. It is developed by Google and is used to build mobile, desktop, backend and web applications. Dart is an object-oriented, class defined, garbage-collected language using a C-style syntax that transcompiles optionally into JavaScript.

Dart supports Just In Time (JIT) as well Ahead Of Time (AOT) compiling.

Just In Time (JIT)

Just In Time (JIT) allows fast development called Hot-Reloading that use in the Flutter App Development.

Ahead Of Time (AOT)

Ahead Of Time (AOT) compiler converts Dart into an efficient native code which makes flutter faster.

2. Dart’s Hello World

We are going to write a very simple program that prints “Hello World!” using Repl Editor as below. Dart uses .dart extension to write Dart code. You can see there is a file `main.dart`. If you hit the play button top center of the embedded editor. It will compile the dart file and print “Hello World!”. You can practice writing something else with the following editor. Void main is an entry point of the Dart file. “print” is used to print output “Hello World!”.


Dart support 3 types of comments

Block comment

Inline comment

Documentation comment

5. Control Flow

Control flow in the Dart is similar to other high-level programming languages.

In the following program, we have bool variable “printString” set it to true and checking that variable in the if condition that if printString is true then it will print “printString is true” else it will print “printString is false”

In the following program, we have “fruitJuice” variable that assigned String “C” and that variable we are passing to the switch which will print “Carrot” if we have a break statement in the switch.

Switch with continue

In the following program, we have variable “fruitJuice” that assigned String “ABC” we are using “Continue” statement instead of break. Which will print




Instead of single String

The “Ternary” operator is a kind of if/else substitute. In the following program, we are assigning value to variable “message” with the help of “Ternary” operator “?” (like if) and “:” ( like else). If “printString” is true it will print “Hello World” else “Welcome”. Try to run following program

Written by

We teach & develop for startups

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store