Yuri P.
Yuri P.

Reputation: 369

Cannot use initPolymer().run in DART 1.9.3, Polymer 0.16.1+2

I am trying to upgrade to DART 1.9.3, Polymer 0.16.1

Code that worked before:

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

now reports that

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

Is this a known change/defect? What would be a workaround?

Please, advise.

Upvotes: 3

Views: 149

Answers (1)

ComputerDruid
ComputerDruid

Reputation: 17586

The Polymer.dart release notes for 0.16.0 have:

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.

Which suggests that you should put your ... some code inside a function called realMain() and call it like:

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

Or:

main() => initPolymer();

@initMethod
realMain() => ...

Upvotes: 5

Related Questions