Dart:使用html导入时,隔离无法正常工作 [英] Dart : Isolate not working when using html import

查看:49
本文介绍了Dart:使用html导入时,隔离无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在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:

这篇关于Dart:使用html导入时,隔离无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆