close method

  1. @override
Future<void> close()
override

Close the transport.

Implementation

@override
Future<void> close() async {
  if (_closed) return;
  _closed = true;
  _poller?.cancel();
  _poller = null;

  final bindings = _bindings;
  if (bindings != null && _open) {
    bindings.canUninitialize(channel);
  }

  final rx = _rxCtrl;
  if (rx != null && !rx.isClosed) await rx.close();

  final msg = _rxMsg;
  if (msg != null) malloc.free(msg);
  final msgFd = _rxMsgFd;
  if (msgFd != null) malloc.free(msgFd);
  final ts = _rxTs;
  if (ts != null) malloc.free(ts);

  _open = false;
}