Extending a class with only one factory constructor
dart
Solution
Unfortunately, you can't extend a class if it only has factory constructors, you can only implement it. That won't work well with CustomEvent though since it's a DOM type, which is also why it only has factory constructors: the browser has to produce these instances, the Dart object is just a wrapper. If you try to implement CustomElement and fire one, you'll probably get an error.
Problem
I was wondering which is the best way to extend the `CustomEvent` class, a class which has only one factory constructor. I tried doing the following and ran into an issue with the super constructor : ``` class MyExtendedEvent extends CustomEvent { int count; factory MyExtendedEvent(num count) { return new MyExtendedEvent._internal(1); } MyExtendedEvent._internal(num count) { this.count = count; } } ``` but I can't get it working. I always run into : unresolved implicit call to super constructor 'CustomEvent()' If i try chaning the internal constructor to : ``` MyExtendedEvent._internal(num count) : super('MyCustomEvent') { this.count = count; } ``` I end up with : 'resolved implicit call to super constructor 'CustomEvent()''. I'm not sure what I'm doing wrong - but I guess the problem is that the `CustomEvent` has only one constructor which is a factory constructor (as doc says - http://api.dartlang.org/docs/releases/latest/dart_html/CustomEvent.html) What is the best way to extend a `CustomEvent`, or any class of this form?