- import
dart:html, I can create a new subclassMyButtonofButtonElementwith factory constructor ,and add some new function such asgetButtonName(){}... when it's running ,I get a instance
MyButton btn=new MyButton()But the instance "btn" runtime type is still
ButtonElement, and can't call thegetButtonName()function. If I usebtn as MyButtonthen I get this errorUncaught CastError: Casting value of type ButtonElement to incompatible type MyButton
Here is the code
class MyButton extends ButtonElement {
factory MyButton(){
return new ButtonElement();
}
String getButtonName(){
return "ButtonName";
}
}