Dart is a client-optimized language for fast apps on any platform. In this guide, you will learn about a way to run Dart on your computer. Let’s get started with Dart.
- Dart is an open-source programming language that is developed by Google. Dart is an object-oriented language.
- We can use Dart on the server side as well as on the client-side.
- Dart is generally used to create single-page websites and web applications. The Gmail application uses dart programming language.
- Dart has become popular along with the Flutter framework for developing cross-platform mobile apps.
Hello World Program
Let’s see how we can run a dart program on our computers.
Here we will learn to create our first program hello_world that will print the text hello world.
void main() { print("Hello World!"); }
The dart program starts with the main keyword. Before main, we are using the void which denotes that the main function won’t return anything.
The parentheses after main indicate that it is a function and all the codes are written inside the curly braces.
To run the program,
- Copy and paste the above code in a file with the filename hello_world.dart. The .dart extension denotes that it is a dart program.
2. Open the terminal/command prompt. Navigate to the file location and type
dart hello_world.dart.
3. You will get the Hello World! output on the terminal.
There are other ways to run a dart program.
However, we are going to use this method explained above as this is the easiest one.
Now that we know how to run a dart program, let’s start with the fundamentals of the dart programming language.
Next Chapter: Variables.