
新建文件hello.dart,如下:
1 |
// 定义一个函数 |
其中main()函数是必须的顶层函数,是程序执行的入口。函数返回void。
执行命令:
1 |
$ dart hello.dart |
执行输出结果为:
1 |
Hello World! Welcome to autoref.cn! |
main的可选参数
main函数有一个可选的List
1 |
void main(List<String> arguments) { |
执行命令:
1 |
$ dart args.dart 1 test |




近期评论