I tried this example and it works https://gist.github.com/olostan/7883315
import "dart:isolate";
void main() {
print("Starting");
var sPort = new ReceivePort();
SendPort rPort;
sPort.listen((msg) {
if (msg is SendPort) {
print("Host got port. sending back");
rPort = msg;
rPort.send("Hello!");
}
else print("Host got $msg");
rPort.send(null);
sPort.close();
});
Isolate.spawn(test,sPort.sendPort);
}
void test(sender) {
var rPort = new ReceivePort();
sender.send(rPort.sendPort);
rPort.listen((msg){
print("Worker got $msg");
if (msg!=null)
sender.send("I am worker");
else rPort.close();
});
}
Isolates seem not to be used too much yet so there may still be some bugs.
The latest problems I remember reading about was debugging code running in isolates. I don't know if this is solved yet.
It also depends if you want to use isolates on the server or in the browser.
AFAIK it's more stable in the VM.