A Basic Dart Program

Published on 29 March 2020
Last Updated on 29 March 2020

Given below is a simple example of a basic Dart program.

Simple program


import 'dart:math' as math;

const numberNine = 9;

void main(List<String> arguments) {
  print('square root of ${numberNine} is');

Program output

Above program produces following output:

square root of 9 is

Program Description

Above program demonstrates how a basic dart program might look like. A dart command line program typically has an import statement, followed by variable declaration and a main function.

main() Function

main() function serves as an entry point to a basic Dart program.