IpcService constructor

IpcService(
  1. String path
)

Implementation

IpcService(String path) {
  final host = InternetAddress(path, type: InternetAddressType.unix);
  final controller = StreamChannelController<List<int>>(sync: true);
  Socket.connect(host, 0).then((socket) {
    _socket = socket;
    socket.cast<List<int>>().pipe(controller.local.sink);
    controller.local.stream.pipe(socket);
  }, onError: controller.local.sink.addError);

  _client = Peer(
    controller.foreign.encodedAsUtf8,
    onUnhandledError: (error, stackTrace) {
      assert(() {
        print('Error: $error with stackTrace: $stackTrace');
        return true;
      }());
    },
  );
  _client.listen();
}