toHex method
Returns the textual representative of the Color as a hex string
leadingHashSign
- whether or not to prefix a hash symbol (#) (defaults to true
)
includeAlpha
- whether or not to include the opacity of the colour (defaults to true
)
Implementation
String toHex({bool leadingHashSign = true, bool includeAlpha = true}) => '${leadingHashSign ? '#' : ''}'
'${includeAlpha ? alpha.toRadixString(16).padLeft(2, '0') : ''}'
'${red.toRadixString(16).padLeft(2, '0')}'
'${green.toRadixString(16).padLeft(2, '0')}'
'${blue.toRadixString(16).padLeft(2, '0')}';