ChildPortClient constructor

ChildPortClient(
  1. SendPort sendPort
)

Implementation

ChildPortClient(this.sendPort) {
  receivePort.listen((message) {
    if (message is _PortChannelResult) {
      final handler = handlers.remove(message.requestId);
      assert(handler != null);
      if (message.success) {
        handler!.complete(message.result);
      } else {
        handler!.completeError(message.error, message.stackTrace);
      }
    }
  });
}