List of functions with a specific signature in Dart

In Dart, is it possible to have a list of functions that have a well-defined signature? I'm looking for something like

List<(int, int) -> int> listOfFunctions; 

which, of course, is wrong.

I can do

 List<Function> listOfFunctions; 

but then I don’t know the signature.

Thanks for any tips.

+5
source share
1 answer

Just create a typedef for your function

 typedef int MyFunction(int a, int b); List<MyFunction> listOfFunctions; 
+7
source

All Articles