MySQLPacketOK.decode constructor

MySQLPacketOK.decode(
  1. Uint8List buffer
)

Implementation

factory MySQLPacketOK.decode(Uint8List buffer) {
  final byteData = ByteData.sublistView(buffer);
  int offset = 0;

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

  final affectedRows = byteData.getVariableEncInt(offset);
  offset += affectedRows.item2;

  final lastInsertID = byteData.getVariableEncInt(offset);
  offset += lastInsertID.item2;

  return MySQLPacketOK(
    header: header,
    affectedRows: affectedRows.item1,
    lastInsertID: lastInsertID.item1,
  );
}