Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Override method in dart on fly (like JAVA)

Tags:

dart

Is there way to overriding method in Dart like JAVA, for example:

public class A {
    public void handleLoad() {
    }
}

And when overriding:

A a = new A() {
    @Override
    public void handleLoad() {
        // do some code
    }
};
like image 702
raiym Avatar asked May 05 '14 08:05

raiym


Video Answer


1 Answers

No, Dart does not have anonymous classes. You have to create a class that extends A and instantiate it.

like image 189
Alexandre Ardhuin Avatar answered Sep 20 '22 11:09

Alexandre Ardhuin