writeOp static method

int writeOp(
  1. Uint8List out,
  2. int offset,
  3. WalOpKind kind,
  4. Uint8List key,
  5. Uint8List? value,
)

Writes one operation and returns the end offset.

Implementation

static int writeOp(
  Uint8List out,
  int offset,
  WalOpKind kind,
  Uint8List key,
  Uint8List? value,
) {
  var pos = offset;
  out[pos++] = kind.code;
  pos = _writeVarint(out, pos, key.length);
  out.setRange(pos, pos + key.length, key);
  pos += key.length;
  if (value == null) {
    return _writeVarint(out, pos, 0);
  }
  pos = _writeVarint(out, pos, value.length);
  out.setRange(pos, pos + value.length, value);
  return pos + value.length;
}