gpt4 book ai didi

dart - 无法在 DART 1.9.3、Polymer 0.16.1+2 中使用 initPolymer().run

转载 作者:行者123 更新时间:2023-12-01 11:33:48 25 4
gpt4 key购买 nike

我正在尝试升级到 DART 1.9.3、Polymer 0.16.1

之前有效的代码:

initPolymer().run((){
... some code
}

现在报道

"the method run() is not defined for Future<Zone>"

这是已知的更改/缺陷吗?有什么解决方法?

请指教。

最佳答案

Polymer.dart release notes for 0.16.0有:

Breaking Changes

The initPolymer() method now returns a Future instead of a Zone. This is not completed until all @HtmlImport imports have finished loading. See the changelog for more information and a few example migration paths.

这表明您应该将您的...一些代码放在一个名为realMain() 的函数中,并像这样调用它:

main() => initPolymer().then((zone) => zone.run(realMain));
realMain() => ...

或者:

main() => initPolymer();

@initMethod
realMain() => ...

关于dart - 无法在 DART 1.9.3、Polymer 0.16.1+2 中使用 initPolymer().run,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29660273/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com