In this article, they spawned an isolate like this:
import 'dart:isolate';
void main() async {
final receivePort = ReceivePort();
final isolate = await Isolate.spawn(
downloadAndCompressTheInternet,
receivePort.sendPort,
);
receivePort.listen((message) {
print(message);
receivePort.close();
isolate.kill();
});
}
void downloadAndCompressTheInternet(SendPort sendPort) {
sendPort.send(42);
}
But I can only pass in the receive port. How do I pass in other arguments?
I found an answer so I'm posting it below.
dynamic
notObject
. – Gera