Dart Hello World Program

In this tutorial you will learn about the Dart Hello World Program and its application with practical example.

Dart Hello World Program

The “Hello world!” program is a simplest program that will display some text on the screen. The “Hello world!” program is a simple yet complete program for beginners that illustrates the basic syntax of any programming language. The “Hello world!” program gives you a way to test systems and programming environment. This tutorial will guide you through writing a basic “Hello, World” program in Dart Programming Language.

Prerequisites

Before starting with this tutorial we assume that you already have Dart SDK installed (If you do not have Dart SDK installed then install it before you get started) as well as a local programming environment must be set up on your computer.

Creating Dart Hello World Program

Step 1:- Create a file called “helloworld.dart” using a text editor program of your choice. The .dart file extension is used to specify a Dart Program file.

Step 2:- Let’s open the “helloworld.dart” file that we created, and put the following line of code in it and save it.

Let’s understand each and every part of the above program.

1. Comments – This is comment statements being used to provide information about the program we created.

2. main() – It is the entry point of our program from where the program execution begins. It is special, required, top-level function where execution of program begins.

3. print() – The print() function is used to output/display the content between double quotes to the screen. The print() method is similar to Perl, Java, or any other language.

Example:-

Running Dart program

Step 3:- Now, compile and run above the Dart program

Once the program is executed it will print “Hello World!”.

Output:-

dart_hello_world_program

In this tutorial we have learn about the Dart Hello World Program and its application with practical example. I hope you will like this tutorial.