Calling a function with an array of parameters in Dart
The Function.apply method does precisely what you want.You can do Function.apply(func, params)
and it will call func
if the parameters match (and throw if they don't).
Not to my knowledge. At this point, Dart doesn't support varargs
. For now, just take an Iterable
as a parameter instead.
I posted a similar question not so long ago : Packing/Unpacking arguments in Dart
Currently not supported but the dart team is aware of this feature. Not their priority though.