toHex method

String toHex({
  1. bool hashSing = true,
  2. bool alphaValue = false,
})

hashSing:

  • true: #AARRGGBB;
  • false: AARRGGBB

alphaValue:

  • true: #AARRGGBB;
  • false: #RRGGBB

Implementation

String toHex({bool hashSing = true, bool alphaValue = false}) =>
    '${hashSing ? '#' : ''}'
    '${alphaValue ? alpha.toRadixString(16).padLeft(2, '0') : ''}'
    '${red.toRadixString(16).padLeft(2, '0')}'
    '${green.toRadixString(16).padLeft(2, '0')}'
    '${blue.toRadixString(16).padLeft(2, '0')}';