pushInt method

void pushInt(
  1. int majorTag,
  2. int value
)

Append an integer value with a specified major tag to the byte sequence in the buffer.

Implementation

void pushInt(
  int majorTag,
  int value,
) {
  majorTag <<= 5;
  int? length = bytesLength(value);
  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));
  }
}