Edited to make the question more clear.
I am trying to work with Isolates (or Web Workers) in Dart. The only ways I can find to communicate between the
You can now use the MessageBox class to communicate the other way around. This code sends a message from the Isolate code as soon as it receives the Sink end of the MessageBox. Main thread receives the messages sent from the Isolate and prints it on the console of Dartium. Once you receive the Sink you can launch your game logic and send updates using the sink object received.
import 'dart:html';
import 'dart:isolate';
void main() {
IsolateSink isolateSink = streamSpawnFunction(myIsolateEntryPoint);
MessageBox isolateMessageBox = new MessageBox();
isolateSink.add(isolateMessageBox.sink);
isolateMessageBox.stream.listen((String data) {
print(data);
});
}
void myIsolateEntryPoint() {
stream.listen((IsolateSink messageBoxSink) {
messageBoxSink.add("Test");
});
}