zid property

ZenohId get zid

Returns the ZenohId of this session.

Throws StateError if the session has been closed.

Implementation

ZenohId get zid {
  _ensureOpen();
  final idSize = bindings.zd_id_sizeof();
  assert(idSize == 16, 'z_id_t drifted from 16 bytes: $idSize');
  final outId = calloc<Uint8>(idSize);
  try {
    final loanedSession = bindings.zd_session_loan(_ptr.cast());
    bindings.zd_info_zid(loanedSession, outId);
    return ZenohId(Uint8List.fromList(outId.asTypedList(idSize)));
  } finally {
    calloc.free(outId);
  }
}