isolatengine 0.0.8 isolatengine: ^0.0.8 copied to clipboard
isolate communication engine.
Usage #
void _entry(SendPort sendPort) async {
final receivePort = ReceivePort();
final engine = Isolatengine(receivePort, sendPort);
engine['ping'] = (param, cancelable, notify) async{
return 'pong';
};
await engine.receive();
}
void startEngine(){
final receivePort = ReceivePort();
this.engine = Isolatengine(receivePort);
Isolate.spawn(_entry, receivePort.sendPort);
engine.receive();
}
And now you can call emit or deliver function. #
final r = await this.engine.deliver('ping');