How can I execute two dart code in one HTML

坚强是说给别人听的谎言 提交于 2019-12-03 16:27:30
Günter Zöchbauer

It's called deferred loading. Basically this feature exists a while already but I haven't used it myself yet. Because of some open issues this feature seemed of limited use. I saw a notice that several bugs or missing feature were fixed but I can't tell the current status.

For more information see
- https://api.dartlang.org/apidocs/channels/be/dartdoc-viewer/dart:async.DeferredLibrary
- http://blog.sethladd.com/2013/04/lazy-load-libraries-in-dart.html
- https://code.google.com/p/dart/issues/detail?id=10171 - Code Splitting in Dart
- https://code.google.com/p/dart/issues/detail?id=3940
- https://code.google.com/p/dart/issues/detail?id=9483

Update

I tried it and it works in Chrome (not in Dartium) with a few small changes

test.dart

library some_lib_name; // <== was missing

void init() {
  print("coucou");
}

index.dart

const lazy = const DeferredLibrary('some_lib_name'); // use the library name not the file name
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!