Dart:使用html导入时,隔离无法正常工作 [英] Dart : Isolate not working when using html import
问题描述
我在Dart中发现了这种非常奇怪和不幸的行为.当我在主文件中导入"dart:html"时,我的隔离将停止工作.
I found this very strange and unfortunate behavior in Dart. When I import 'dart:html' in my main file, my Isolate stops working.
使用我的文件"isolate.dart":
With my file "isolate.dart" :
main(){
print('BAM');
}
这将显示"BAM":
import 'dart:core';
import 'dart:isolate';
void main() {
Isolate.spawnUri(Uri.parse('isolate.dart'), [], null);
}
但这不会显示任何内容:
but this prints nothing :
import 'dart:core';
import 'dart:isolate';
import 'dart:html';
void main() {
Isolate.spawnUri(Uri.parse('isolate.dart'), [], null);
}
使用html导入时如何使隔离工作?
How can I get Isolate to work while using the html import?
更新:我已经找到此代码 https://github.com/TomCaserta/ExampleIsolate 并尝试将其用于找到问题.似乎来自隔离的print()调用引起了问题.
UPDATE : I've found this code https://github.com/TomCaserta/ExampleIsolate and tried to work it to find the problem. It seems like the print() call from the Isolate is causing problems.
推荐答案
这是已知的错误/局限性.正在处理中.
This are known bugs/limitations. It is being worked on.
当前无法在隔离中访问'dart:html'软件包的功能,并且'print()'使隔离崩溃,这可能是因为没有可用于重定向命令的具有'打印'功能的软件包
Currently it is not possible to access functionality of the 'dart:html' package in an isolate and 'print()' crashes the isolate probably because there is no package with a 'print' functionality available where the command can be redirected to.
Dart问题跟踪器目前似乎不可用.
我稍后再试以添加一些引用.
一些我认为与之相关的未解决问题:
Some open issues that I think are related:
- 隔离中的打印语句会导致隔离崩溃.
- Dartium DOM隔离中不允许使用Isolate.spawn
- 在Dartium中支持dom隔离的产生
- 无法在spawnUri加载的库中的断点处中断
- 在dartium中隔离而不创建httprequest,在编译为javascript时有效
这篇关于Dart:使用html导入时,隔离无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!