Why am I getting a type error on the polymer.dart element?
I have some code:
// main.dart: void main{ initPolymer(); var view = new ChatAppConsumer(); } //chat_app.dart @CustomTag('chat-app') class ChatApp extends PolymerElement{ ChatApp.created():super.created(); } class ChatAppConsumer{ final ChatApp view = new Element.tag('chat-app'); }
As far as I can tell, I have all my files that are linking correctly and I call initPolymer();
before I try to create my own tag, but I get a type error that HtmlElement ChatApp` returns new Element.tag('chat-app'); is not of type
, but I use this exact template in another package from I have it and it works great there. Has anyone come across something like this before?
source to share
initPolymer
not enough, you must pass a closure to initPolymer.run(() => ...)
which your Polymer-related code executes.
See how to implement basic function in polymer applications for details .
= polymer 0,16,0 //main.dart: empty function {initPolymer (), then ((zone) => zone.run (() {var view = new ChatAppConsumer ();})); }
<Polymer 0.16.0
// main.dart: void main{ initPolymer().run(() { var view = new ChatAppConsumer(); }); }
source to share