I'm coming from Delphi and the paradigm may be different but I want to do define a custom event handler in Dart, something like the pseudo code below.
// -- I don't know how to define this type...
typedeft TCustomEvent = function (int pParam) of object;
class MyFirstClass {
TCustomEvent onDoSomething;
void doIt(int pValue){
onDoSomething(pValue);
}
}
class MySecondClass {
void makeMyFirstClassDoIt(){
MyFirstClass vObj = MyFirstClass();
vObj.onDoSomething = doSomething;
vObj.doIt(5);
}
doSomething(int pValue) {
print(pValue);
}
}
Any help would be greatly appreciated.