MySQLPacket.decodeAuthSwitchRequestPacket constructor
MySQLPacket.decodeAuthSwitchRequestPacket(
- Uint8List buffer
Implementation
factory MySQLPacket.decodeAuthSwitchRequestPacket(Uint8List buffer) {
final byteData = ByteData.sublistView(buffer);
int offset = 0;
final header = MySQLPacket.decodePacketHeader(buffer);
offset += 4;
final payloadLength = header.item1;
final sequenceNumber = header.item2;
final type = byteData.getUint8(offset);
if (type != 0xfe) {
throw MySQLProtocolException(
"Can not decode AuthSwitchResponse packet: type is not 0xfe");
}
final payload = MySQLPacketAuthSwitchRequest.decode(
Uint8List.sublistView(buffer, offset));
return MySQLPacket(
sequenceID: sequenceNumber,
payloadLength: payloadLength,
payload: payload,
);
}