toHex method
- int value
Converts an integer value to a hexadecimal string.
value
: The integer value to convert, which should represent one of the RGB color components.- Returns: A string in hexadecimal format, with a leading
$
and two digits.
Implementation
String toHex(int value) {
return '\$${value.toRadixString(16).padLeft(2, '0').toUpperCase()}';
}