MySQLPacket.decodeAuthSwitchRequestPacket constructor

MySQLPacket.decodeAuthSwitchRequestPacket(
  1. Uint8List buffer
)

Decodifica um pacote Auth Switch Request MySQLPacketAuthSwitchRequest.

Implementation

factory MySQLPacket.decodeAuthSwitchRequestPacket(Uint8List buffer) {
  final header = decodePacketHeader(buffer);
  final payloadBytes = _extractPayload(buffer, header.$1);
  final type = payloadBytes[0];

  if (type != 0xfe) {
    throw MySQLProtocolException(
        "Cannot decode AuthSwitchResponse packet: type is not 0xfe");
  }

  final payload = MySQLPacketAuthSwitchRequest.decode(payloadBytes);
  return MySQLPacket(
    sequenceID: header.$2,
    payloadLength: payloadBytes.length,
    payload: payload,
  );
}