Dart main() Function

In this tutorial you will learn about the Dart main() Function and its application with practical example.

Dart main() Function

This is the most vital part of each and every Dart program, it is mandatory for every Dart program to have a top-level main() function definition. There can be only one main() function in Dart program. It serves as the entry point for every Dart program or app; the execution of a Dart program or application starts with the main() function. The Dart program can not be executed without the main() function. The main() function is responsible for the execution of all the user defined statement, functions and library functions. The main() function further structured into variable declaration, function declaration and user defined executable statements. The main() function returns void and can have an optional List<String> parameter as arguments. Below is the general syntax of a typical main() function.

Table Of Contents

Syntax:-

Example:-

Output:-

dart_main_function_example_program

In this tutorial we have learn about the Dart main() Function and its application with practical example. I hope you will like this tutorial.