toUnsigned method

BigInteger toUnsigned(
  1. int bitLength
)

Returns the value of this BigInteger masked to an unsigned representation with the given bitLength.

Example:

final x = BigInteger.fromInt(-1);
print(x.toUnsigned(8)); // 255

Implementation

BigInteger toUnsigned(int bitLength) {
  if (bitLength < 0) {
    throw InvalidFormatException('bitLength must be non-negative');
  }
  return BigInteger._(_value.toUnsigned(bitLength));
}