Is there a way to pass a generic Function as Parameter to an Isolate at spawn? I have attached a simplifyed version of my code (not working) but is there a way to archive this without dynamics? Or is the Type of the functionToCall decided at runtime and not at complietime and so not possible to decide for an isolate?
import 'dart:isolate';
class TestClass {
// ...
}
void main(List<String> args) {
ReceivePort receivePort = ReceivePort();
Isolate.spawn(functionToCall<TestClass>, receivePort.sendPort);
}
void functionToCall<T>(SendPort sendPort) {
// ...
}