toTlv method
Implementation
Uint8List toTlv(int capacity) {
final Uint8List tagBytes = IsoUtil.hex2byte(tag.toRadixString(16));
final Object? current = value;
if (current == null) return IsoUtil.concat(tagBytes, encodeLength(0));
final Uint8List packedValue = current is TlvList ? current.pack(capacity) : current as Uint8List;
return IsoUtil.concat(IsoUtil.concat(tagBytes, encodeLength(packedValue.length)), packedValue);
}