encode method

  1. @override
Uint8List encode(
  1. List<TLV> tlvList
)
override

Encode list tlv to list bytes

Implementation

@override
Uint8List encode(List<TLV> tlvList) {
  final byteLists = <Uint8List>[];
  for (final tlv in tlvList) {
    final typeBytes = Uint8List.fromList([tlv.type]);
    final lengthBytes = _encodeLength(tlv.value.length);
    byteLists.addAll([typeBytes, lengthBytes, tlv.value]);
  }
  return _concatenateUint8List(byteLists);
}