pushInt method
void
pushInt(
- int majorTag,
- int value, {
- CborLengthEncoding lengthEncdoing = CborLengthEncoding.canonical,
Append an integer value with a specified major tag to the byte sequence in the buffer.
Implementation
void pushInt(int majorTag, int value,
{CborLengthEncoding lengthEncdoing = CborLengthEncoding.canonical}) {
majorTag <<= 5;
final int? length = bytesLength(value, lengthEncdoing: lengthEncdoing);
pushUInt8(majorTag | (length ?? value));
if (length == null) return;
final int len = 1 << (length - 24);
if (len <= 4) {
pushBytes(IntUtils.toBytes(value, length: len));
} else {
pushBigint(BigInt.from(value));
}
}