美文网首页
在idea中运行Dart

在idea中运行Dart

作者: 天天想念 | 来源:发表于2021-06-11 15:01 被阅读0次

参考链接:https://dart.dev/guides/language/language-tour#the-main-function
1.在idea中安装dart插件
2.配置dart的本地SDK
3.新建dart命令行工程
new project ->dart->command-line applaction

new project
commandline
4.创建commandlineDemo.dart文件,添加如下内容
void main(List<String> arguments) {
  print(arguments);

  assert(arguments.length == 2);
  assert(int.parse(arguments[0]) == 1);
  assert(arguments[1] == 'test');
}

5.进入当前工程的目录,然后通过命令行运行dart文件dart commandlineDemo.dart 1 test
如果需要在idea中运行commandlineDemo.dart文件,在运行时需要添加参数
在文件中右键->Edit commandlineDemo.dart....

Edit commandlineDemo.dart
在program argument中添加 1 test后,点击保存
然后ctrl + R 运行
run

相关文章

网友评论

      本文标题:在idea中运行Dart

      本文链接:https://www.haomeiwen.com/subject/vnqveltx.html