Let us start our learning with long-established hello world program. which will print hello world as output in console.
void main() {
print('Hello World');
}
Output: Hello World
The main() is a predefined method in Dart. This acts like the beginning part of the application. A Dart script needs the main() method for execution.
Whereas print() is a predefined function that prints the specified string or value to the standard output i.e. the terminal or console.
In addition to this let us know about other commands in Dart
For Executing the dart code via terminal or command prompt
dart hello_world.dart
To know the current version of the dart SDK in our system
dart --version
Code commenting in dart language can be done in two ways they're Single line commenting & Multi-line commenting
Single Line Commenting: when we want to comment on a single line we use this type of comment it can be declared as '//'
Ex:
// void main() {
// print('Hello World');
// }
Multi-Line Commenting: For Commenting on multiple lines it can be declared as /**/
Ex:
/*void main() {
print('Hello World');
}*/