compactVec<T> static method

CustomLayout<Map<String, dynamic>, List<T>> compactVec<T>(
  1. Layout<T> elementLayout, {
  2. String? property,
})

Implementation

static CustomLayout<Map<String, dynamic>, List<T>> compactVec<T>(
    Layout<T> elementLayout,
    {String? property}) {
  final layout =
      struct([seq(elementLayout, compactOffset(), property: 'values')]);
  return CustomLayout<Map<String, dynamic>, List<T>>(
    layout: layout,
    encoder: (data) => {"values": data},
    decoder: (data) => (data["values"] as List).cast<T>(),
    property: property,
  );
}