toHex method

String toHex()

Returns this color encoded as an uppercase hexadecimal RGBA string.

Format: RRGGBBAA

Example:

color.toHex(); // "FF0000FF"

Implementation

String toHex() =>
  '${r.toRadixString(16).padLeft(2, '0').toUpperCase()}'
  '${g.toRadixString(16).padLeft(2, '0').toUpperCase()}'
  '${b.toRadixString(16).padLeft(2, '0').toUpperCase()}'
  '${a.toRadixString(16).padLeft(2, '0').toUpperCase()}';