MySQLPacketAuthSwitchRequest.decode constructor

MySQLPacketAuthSwitchRequest.decode(
  1. Uint8List buffer
)

Implementation

factory MySQLPacketAuthSwitchRequest.decode(Uint8List buffer) {
  final byteData = ByteData.sublistView(buffer);

  int offset = 0;

  final header = byteData.getUint8(offset);
  offset += 1;

  final authPluginName = buffer.getUtf8NullTerminatedString(offset);
  offset += authPluginName.item2;

  final authPluginData = Uint8List.sublistView(buffer, offset);

  return MySQLPacketAuthSwitchRequest(
    header: header,
    authPluginData: authPluginData,
    authPluginName: authPluginName.item1,
  );
}