Dart js-interop not working if .dart file isn't included

三世轮回 提交于 2020-01-05 06:02:45

问题


After announcing new strategy for Dart, i decided to change include from

<script type="application/dart" src="/dart/script.dart"></script>

to

<script type="text/javascript" src="/dart/script.dart.js"></script>

But in that case js-interop seems broken. dart:js.context is empty. Is there any workarounds for this?


回答1:


It looks like you are missing this script tag:

<script data-pub-inline src="packages/browser/dart.js"></script>

There is also an open issue to fix this http://dartbug.com/23005



来源:https://stackoverflow.com/questions/29406133/dart-js-interop-not-working-if-dart-file-isnt-included

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!