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 and 'z' being 35.
The radix
argument must be an integer in the range 2 to 36.
Example:
// Binary (base 2).
print(Obj(12).toRadixString(2)); // 1100
print(Obj(31).toRadixString(2)); // 11111
print(Obj(2021).toRadixString(2)); // 11111100101
print(Obj(-12).toRadixString(2)); // -1100
// Octal (base 8).
print(Obj(12).toRadixString(8)); // 14
print(Obj(31).toRadixString(8)); // 37
print(Obj(2021).toRadixString(8)); // 3745
// Hexadecimal (base 16).
print(Obj(12).toRadixString(16)); // c
print(Obj(31).toRadixString(16)); // 1f
print(Obj(2021).toRadixString(16)); // 7e5
// Base 36.
print(Obj(35 * 36 + 1).toRadixString(36)); // z1
Implementation
String? toRadixString(int radix) => value?.toRadixString(radix);