getPacketLength static method

int getPacketLength(
  1. Uint8List buffer, [
  2. int offset = 0
])

Retorna o tamanho total do pacote (cabeçalho de 4 bytes + payload).

Lê os 3 primeiros bytes do buffer para calcular payloadLength e soma 4 (bytes do cabeçalho).

Implementation

@pragma('vm:prefer-inline')
static int getPacketLength(Uint8List buffer, [int offset = 0]) {
  return getPayloadLength(buffer, offset) + 4;
}