Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我刚刚尝试运行一个较旧的 Dart 应用程序,我收到了这个错误:
Breaking on exception: ReferenceError: ReceivePortSync is not defined
这个异常来自哪里,我该如何解决?
当您看到 时ReceivePortSync is not defined,这意味着您缺少interop.js脚本。
ReceivePortSync is not defined
interop.js
只需添加以下内容:
<script src="packages/browser/interop.js"></script>
在</body>您页面的标签之前。
</body>
此外,您需要仔细检查您js的 pubspec.yaml 中是否有该包作为依赖项。就像是:
js
name: my_app dependencies: js: any