dart typedefs implementation code example
Example 1: dart typedef
typedef ManyOperation(int firstNo, int secondNo); // function signature to match
Subtract(int firstNo, int second){
print("Subtract result is ${firstNo-second}");
}
Calculator(int a, int b, ManyOperation oper){ // matches function signature
oper(a,b);
}
main(){
Calculator(5, 5, Subtract); // 'Subtract result is 0'
}
Example 2: dart typedef
//Return type not part of typedef
typedef function_name(parameters)