vecU8 static method

CustomLayout vecU8({
  1. String? property,
  2. IntegerLayout? lengthSizeLayout,
})

vector bytes

Implementation

static CustomLayout vecU8(
    {String? property, IntegerLayout? lengthSizeLayout}) {
  lengthSizeLayout ??= (lengthSizeLayout?.clone(newProperty: "length") ??
      u32(property: "length"));
  final length = padding(lengthSizeLayout, propery: "length");
  final layout = struct([
    length,
    blob(offset(length, -length.span), property: 'data'),
  ]);
  return CustomLayout(
    layout: layout,
    encoder: (data) => {"data": data},
    decoder: (data) => data["data"],
    property: property,
  );
}