encodeInto static method

int encodeInto(
  1. Uint8List out,
  2. int offset,
  3. List<WalOp> ops
)

Encodes ops into out starting at offset; returns the end offset.

Implementation

static int encodeInto(Uint8List out, int offset, List<WalOp> ops) {
  var pos = _writeVarint(out, offset, ops.length);
  for (final op in ops) {
    out[pos++] = op.kind.code;
    pos = _writeVarint(out, pos, op.key.length);
    out.setRange(pos, pos + op.key.length, op.key);
    pos += op.key.length;
    final value = op.value;
    if (value == null) {
      pos = _writeVarint(out, pos, 0);
    } else {
      pos = _writeVarint(out, pos, value.length);
      out.setRange(pos, pos + value.length, value);
      pos += value.length;
    }
  }
  return pos;
}