Unsupported operation: dart:isolate is not supported on dart4web

Dart2 SDK在Web端不再支持dart:isolate库,推荐使用WebWorkers代替。dart:isolate由于其限制性和JavaScript编译时的额外开销而被弃用。dart:mirrors也被移除,建议使用code generation工具如package:build和package:source_gen。这一改变旨在优化Web开发的性能和效率。
摘要由CSDN通过智能技术生成

dart2 sdk web端不再支持对 isolate 的支持。

对于javascript玩家推荐使用 Web Workers 替换。API不支持多端统一这让人太不爽了,如果你有什么方法解决,求评论告知,万分感谢!

不再支持的原因:

原论坛链接:https://groups.google.com/a/dartlang.org/g/misc/c/djfFMNCWmkE/m/F7WE8a0JAwAJ?pli=1

原文:

As part of our work to ship Dart 2, we are removing support in our web tools for dart:mirrors and dart:isolate. You will see this change in dart2js and the Dart Dev Compiler in the next few weeks on the Dart SDK dev channel.
Note: the Dart VM will continue to fully support both libraries.
Details:
dart:isolate - This library was an attempt to provide a single API that provides common concurrency functionality across Dart’s web and native platforms. While useful in some cases, most users found the isolate API limiting compared to the Web Workers API. The infrastructure for supporting isolates also adds substantial overhead when compiling to JavaScript. In the future, you should use Web Workers to access concurrency on the web.
dart:mirrors - This library provides a runtime reflection API. To provide a full fidelity experience, Dart JavaScript compilers included a substantial amount of type information while also losing the ability to do precise tree-shaking. This leads to dramatically increased output size and execution time. We recommend web developers use code generation using tools like package:build and package:source_gen. These are the tools used by AngularDart and package:json_serializable.
If you have questions about this change, please post on the Dart discussion group.

For more news and information, visit https://plus.google.com/+dartlang
To join the conversation, visit https://groups.google.com/a/dartlang.org/

翻译:

作为发布Dart 2的工作的一部分,我们正在删除Web工具中对dart:mirrors和dart:isolate的支持。在接下来的几周内,您将在Dart SDK开发人员频道上看到dart2js和Dart Dev Compiler中的这一更改。
注意:Dart VM将继续完全支持两个库。
详细信息:dart:isolate-该库试图提供一个API,该API在Dart的Web和本机平台上提供通用的并发功能。尽管在某些情况下很有用,但大多数用户发现与Web Workers API相比,隔离API的限制。支持隔离的基础结构在编译为JavaScript时也增加了相当大的开销。将来,您应该使用Web Workers来访问Web上的并发性。
dart:mirrors-该库提供了运行时反射API。为了提供完整的保真度体验,Dart JavaScript编译器包含了大量的类型信息,同时也失去了进行精确摇树的能力。这导致输出大小和执行时间大大增加。我们建议Web开发人员使用诸如package:build和package:source_gen之类的工具来生成代码。这些是AngularDart和package:json_serializable使用的工具。
如果您对此更改有疑问,请在Dart讨论组上发帖。

有关更多新闻和信息,请访问 https://plus.google.com/+dartlang
加入对话,请访问 https://groups.google.com/a/dartlang.org/

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值