Reputation: 14848
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 properly referenced and Im calling initPolymer();
before I attempt to create my custom tag, but I get the type error that the HtmlElement returned by new Element.tag('chat-app'); is not of type
ChatApp` but I use this exact same pattern in another package I have and it works perfectly there. Anyone come across something like this before?
Upvotes: 2
Views: 84
Reputation: 657048
initPolymer
is not enough, you should pass a closure to initPolymer.run(() => ...)
which executes your Polymer related code.
See how to implement a main function in polymer apps for more details
= Polymer 0.16.0 // main.dart: void main{ initPolymer().then((zone) => zone.run(() { var view = new ChatAppConsumer(); })); }
< Polymer 0.16.0
// main.dart:
void main{
initPolymer().run(() {
var view = new ChatAppConsumer();
});
}
Upvotes: 2