toHex method
Prefixes a hash sign if leadingHashSign is set to true (default is true).
Implementation
String toHex({bool leadingHashSign = true}) => '${leadingHashSign ? '#' : ''}'
'${(a * 255).toInt().toRadixString(16).padLeft(2, '0')}'
'${(r * 255).toInt().toRadixString(16).padLeft(2, '0')}'
'${(g * 255).toInt().toRadixString(16).padLeft(2, '0')}'
'${(b * 255).toInt().toRadixString(16).padLeft(2, '0')}';