vec static method

CustomLayout vec(
  1. Layout elementLayout, {
  2. String? property,
})

vectors

Implementation

static CustomLayout vec(Layout elementLayout, {String? property}) {
  final length = u32('length');
  final layout = struct([
    length,
    seq(elementLayout, offset(length, -length.span), property: 'values'),
  ]);
  return CustomLayout<Map<String, dynamic>, dynamic>(
    layout: layout,
    encoder: (data) => {"values": data},
    decoder: (data) => data["values"],
    property: property,
  );
}