In the following class I want to type the onPress method as a function which returns void. Is there a way to do that?
class Human {
var onPress;
Human({
this.onPress,
});
}
class Human {
void Function() onPress;
Human({
this.onPress,
});
}
or
typedef VoidFunction = void Function();
class Human {
VoidFunction onPress;
Human({
this.onPress,
});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With