byteLength property

int get byteLength

The length of this record in bytes.

Implementation

int get byteLength {
  // header + type length + payload length
  int length = 3;

  if (typeNameFormat == TypeNameFormat.empty) {
    return length;
  }

  length += type.length + payload.length;

  // id length
  if (identifier.isNotEmpty) {
    length += 1;
    length += identifier.length;
  }

  // long record
  if (payload.length > 255) {
    length += 3;
  }

  return length;
}