writeVec method

BcsWriter writeVec(
  1. dynamic vector,
  2. dynamic cb(
    1. BcsWriter writer,
    2. dynamic el,
    3. int i,
    4. int len,
    )
)

Write a vector into a buffer by first writing the vector length and then calling a callback on each passed value.

Implementation

BcsWriter writeVec(
  dynamic vector,
  dynamic Function(BcsWriter writer, dynamic el, int i, int len) cb
) {
  writeULEB(vector.length);
  List.from(vector).asMap().forEach((i, el) => cb(this, el, i, vector.length));
  return this;
}