getPayloadLength static method

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

Implementation

@pragma('vm:prefer-inline')
static int getPayloadLength(Uint8List buffer, [int offset = 0]) {
  if (offset < 0 || offset > buffer.length - 3) {
    throw MySQLProtocolException(
      'Truncated MySQL packet header: cannot read payload length at offset '
      '$offset (buffer length ${buffer.length})',
    );
  }
  return buffer[offset] |
      (buffer[offset + 1] << 8) |
      (buffer[offset + 2] << 16);
}