list<T> function

PayloadType<List<T>> list<T>(
  1. PayloadType<T> type, {
  2. PayloadType<int> lengthType = uint32,
})

Make the given type support a list of T.

It stores the length of the list first by using the lengthType and then store each element of the list using the type.

It has a byte length of lengthType.length(list.first) + type.length(list).

Usage:

payload.set(list(uint8), [1, 2 ,3, 4]);

Implementation

PayloadType<List<T>> list<T>(
  PayloadType<T> type, {
  PayloadType<int> lengthType = uint32,
}) =>
    _List(type, lengthType);