toRadixString method
Converts this
to a string representation in the given radix
.
In the string representation, lower-case letters are used for digits above '9', with 'a' being 10 an 'z' being 35.
The radix
argument must be an integer in the range 2 to 36.
Example:
// Binary (base 2).
print(Obj(BigInt.from(12)).toRadixString(2)); // 1100
print(Obj(BigInt.from(31)).toRadixString(2)); // 11111
print(Obj(BigInt.from(2021)).toRadixString(2)); // 11111100101
print(Obj(BigInt.from(-12)).toRadixString(2)); // -1100
// Octal (base 8).
print(Obj(BigInt.from(12)).toRadixString(8)); // 14
print(Obj(BigInt.from(31)).toRadixString(8)); // 37
print(Obj(BigInt.from(2021)).toRadixString(8)); // 3745
// Hexadecimal (base 16).
print(Obj(BigInt.from(12)).toRadixString(16)); // c
print(Obj(BigInt.from(31)).toRadixString(16)); // 1f
print(Obj(BigInt.from(2021)).toRadixString(16)); // 7e5
// Base 36.
print(Obj(BigInt.from(35 * 36 + 1)).toRadixString(36)); // z1
Implementation
String? toRadixString(int radix) => value?.toRadixString(radix);