Skip to main content

Command Palette

Search for a command to run...

Introduction to Dart

Lecture 1: Hello World

Published
2 min read
Introduction to Dart
A

I am a Senior Software Engineer with over 7 years of Experience with Different Programming Languages, Frameworks, and Libraries

In this module, we are going to be using Dart Pad to run our code. With Dart Pad, you can get started learning how to code in Dart on the device of your choice without having to install any software. This article is specifically for those picking up Dart as their first programming language. Every experienced programmer you see out there started with printing their first line of "Hello World". This is just a program that helps to illustrate the basic syntax of a particular language. For example, in Java you print a "Hello World" using this syntax:

public class HelloWorld{
      public static void main(String[] args){
          System.out.println("Hello World");
      }    
}

In the above snippet, I first create a public class called HelloWorld then within the class, I created another static method called main, then within the main, I called the function System.out.println("Hello World"). Dart provides us with a lot easier syntax. All you need to do is:

void main(List<String> args){
  print("Hello World");
}

First, you create a main function, and then within the main, you call the function print("Hello World"). You don't need to worry about understanding what you are writing for now. The goal of this lecture is to get you to write your first line of Dart Code. Then in your Dart Pad you can click on run. Congratulations! You have written your first line of Dart Code. Screenshot 2022-10-25 at 6.59.56 AM.png