toBytes method
Implementation
Uint8List toBytes({Endian endian = Endian.little}) {
final bb = BytesBuilder();
for (var value in encodedValues) {
final bytes = encodedValueToBytes(value, endian: endian);
bb.add(bytes);
}
// sometimes subfields or strings can be less then the allocated field size,
// so we pad the buffer with 0's.
if (bb.length < size) {
bb.add(Uint8List(size - bb.length));
}
return Uint8List.sublistView(bb.toBytes(), 0, size);
}