Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Dart中运行独立于退出的代码?_Dart - Fatal编程技术网

如何在Dart中运行独立于退出的代码?

如何在Dart中运行独立于退出的代码?,dart,Dart,如果启动它的进程退出或终止,我愿意在后台执行pub get。大概是这样的: // ... pubspec.yaml code changes executeInBackground("pub get"); //async call, returns a Future exit(0); 如果不使用Process.runSync()阻塞调用,我怎么能做到这一点?(我希望程序尽快结束)请参阅doc及其模式参数 导入'dart:io'; main()异步{ 最终p=等待进程。开始( “酒吧”, ['g

如果启动它的进程退出或终止,我愿意在后台执行
pub get
。大概是这样的:

// ... pubspec.yaml code changes
executeInBackground("pub get"); //async call, returns a Future
exit(0);
如果不使用Process.runSync()阻塞调用,我怎么能做到这一点?(我希望程序尽快结束)

请参阅doc及其
模式
参数

导入'dart:io';
main()异步{
最终p=等待进程。开始(
“酒吧”,
['get'],
鲁宁谢尔:没错,
mode:ProcessStartMode.DETACHED,//所有的魔力都在这里
);
打印(p.pid);
}