Writing Your First Program in Dart & Flutter in 2025
Understanding Dart Syntax and Writing Hello World Program in Dart in 2025
In this tutorial I will teach you how to write your first program in dart programming language.
Dart is a modern, platform-independent, object-oriented programming language that was developed by Google. It is used to cross-platform mobile apps, websites, web apps and games through its renowned framework called Flutter. It is easy to learn and its syntax is similar to JavaScript.
There are three ways of writing the code in dart which are mentioned below.
1. DartPad
2. Command Line
3. IDE
Most programmers write their first code as printing the “Hello World”. Following is the sample code for printing hello world.
main(){
print(“Hello World”);
}
main() functions is the starting point of the code. Code starts execution from the main function. In above sample code prints “Hello World” on the screen. If you write print(“Hello World”) outside the main function e.g.: outside the curly braces “{}”, you will encounter an error.
- Every line of code ends with semicolon “;” in dart.
- Curly braces “{}” indicate the beginning and ending point of a code.
- Code ending with small braces “()” is a function.
1. DartPad:
DartPad is online website that is free to use, where you can write your dart code and execute it. You can access the website through following link or simply search the dartpad and the webpage will be visible on the top.
Here you can write code on the right side, and on the left you can see output of your code.
https://dartpad.dev/
2. Command Line (CMD) or Terminal
You can also run your dart code through an app called CMD in windows and Terminal in mac. This method requires executing the code through writing the commands in the terminal or CMD app. This also requires basic knowledge about command line.
You need to write the code in any text editor e.g.: notepad and save that in a particular location. After that you need to open the command line app or terminal apps, and navigate to the location of that file where you have stored your dart code.
Once you reach the location of the required file in terminal or cmd then you need to type the name of that file with its extension and press enter. At this point you should be able to see the result of your code.
For example, I have my first code inside documents and it is called testproject1. Note that extension of dart is ‘. dart’.
/Users/mac/Documents/testproject1.dart
3. Integrated Development Environment (IDE)
IDE is often a desktop app where you can run your code and execute it right there. It also provides access to all tools required for development of a particular software such as plugins, external libraries, code correction, advanced compilers etc. right within the app. It makes development lot easier, and more convenient.
When you are developing apps or websites then you will have to use IDEs. Famous IDEs used for flutter development include VSCode, AndroidStudio, IntelliJ. Note that you need to install flutter plugin inside the IDE of your choice then only you will able to code with flutter and dart.
That’s all for this tutorial. I have explained the same in the video of which the link is given below where I have performed what I have mentioned here. You will be able to understand more clearly after watching the video.
https://youtu.be/CjJyodsZ-UE
God Bless You!!




Comments
There are no comments for this story
Be the first to respond and start the conversation.