getPadded static method

Uint8List getPadded(
  1. BigInt n,
  2. int length
)

Implementation

static Uint8List getPadded(BigInt n, int length) {
  var bs = encodeBigInt(n);
  if (bs.length < length) {
    var tmp = Uint8List(length);
    var start = length - bs.length;
    for (var i = 0; start < length; i++, start++) {
      tmp[start] = bs[i];
    }
    bs = tmp;
  }
  return bs;
}