decode method

  1. @override
DecodingResult<List<T>> decode(
  1. ByteBuffer buffer,
  2. int offset
)
override

Decode.

Implementation

@override
DecodingResult<List<T>> decode(ByteBuffer buffer, int offset) {
  final lengthResult = const UintType().decode(buffer, offset);

  final arrayType =
      FixedLengthArray<T>(type: type, length: lengthResult.data.toInt());
  final dataResult =
      arrayType.decode(buffer, offset + lengthResult.bytesRead);

  return DecodingResult(
    dataResult.data,
    lengthResult.bytesRead + dataResult.bytesRead,
  );
}