decode method

  1. @override
List<TLV> decode(
  1. Uint8List data
)
override

Decode list bytes to list tlv model

Implementation

@override
List<TLV> decode(Uint8List data) {
  final tlvList = <TLV>[];
  var offset = 0;
  while (offset < data.length) {
    final type = data[offset++];
    final length = _decodeLength(data, offset);
    offset += _getLengthBytes(length);
    final value = data.sublist(offset, offset + length);
    offset += length;
    tlvList.add(TLV(type: type, length: length, value: value));
  }
  return tlvList;
}