So my question would be a duplicate of this javascript question but mine is about Flutter: I have a method (it is the method add
of class Bloc so I can't await it, I need to send a callback instead) that takes as parameter a Function
to execute it when work is done.
void myMethod(Function onDone) async {
onDone();//how to know if I should write this?
await onDone();//or this?
}
How can I know when I want to execute this Function
parameter if it is sync or async i.e. if I should write await onDone()
or onDone()
?