First Dart Program

Every Dart application starts with the main() function. This is the entry point where execution begins.

Example:

void main() {
  print('Hello, Dart!');
}

Explanation:

  • void means the function does not return any value.
  • main() is the required starting point of all Dart programs.
  • print() outputs the text inside the parentheses to the console.

When you run this program, it will display:

Hello, Dart!

Key Points to Remember

  • Every Dart program must have a main() function
  • Use print() to display output
  • End each statement with a semicolon ;
  • Strings can be enclosed in single '...' or double "..." quotes