Implement Hello World Program in Dart Programming Language

In this tutorial, we are going to learn step by step to create the first hello world program in Dart programming language.

Step 1 - Create Dart source code file

Create a new file named helloworld.dart on your disk, the .dart file extension is specified for Dart source code files.

For example, we create new file at D:\Dart\helloworld.dart

Step 2 - Implement Hello World Application in Dart

The Dart program entry point is the main() method so that we need to implement the main() method in our program.

Open helloworld.dart file above and input source code as the following.

void main() {
  print("Hello mobilecode.dev");
}

For example, I use Visual Code to edit the program.

Dart Hello World in Visual Code

Step 3 - Run the Dart program

To run the Dart program we can use the dart command line tool.

Firstly, open Command Line on your machine then navigate to the source code directory then run dart helloworld.dart to see the output as below.

dart command line tool to run hello world program

Happy Coding 😊

Dart integer Data Type by Examples

Dart double Data Type by Examples

Dart bool Data Type by Examples

Dart String Data Type by Examples

Dart StringBuffer by Examples

Tags: