cToHex method

String cToHex()

Converts the Color object to its hexadecimal representation.

Returns a hexadecimal string representation of the color, including the alpha channel.

  Color color = Colors.blue;
  String hex = color.cToHex();
  print('Hexadecimal representation of $color: $hex');

Implementation

String cToHex() =>
    '#${(this).value.toRadixString(16).padLeft(8, '0').substring(2)}';