toHexString method
Returns a string representing the value of this integer in hexadecimal notation.
Example: Int64(0xf01d).toHexString()
returns 'F01D'
.
The string may interprets the number as unsigned, and has no leading minus, even if the value isNegative.
Example: Int64(-1).toHexString()
returns 'FFFFFFFFFFFFFFFF'
.
Implementation
@override
String toHexString() {
if (isZero) return '0';
Int64 x = this;
String hexStr = '';
while (!x.isZero) {
int digit = x._l & 0xf;
hexStr = '${_hexDigit(digit)}$hexStr';
x = x.shiftRightUnsigned(4);
}
return hexStr;
}