toHex method
Returns this color as a CSS-style hexadecimal string.
Implementation
String toHex({
bool includeAlpha = false,
bool leadingHash = true,
}) {
final value = toARGB32();
final hex = value.toRadixString(16).padLeft(8, '0').toUpperCase();
final body = includeAlpha ? hex : hex.substring(2);
return leadingHash ? '#$body' : body;
}