hexStringToColor function

Color? hexStringToColor(
  1. String? hexColor
)

Implementation

Color? hexStringToColor(String? hexColor) {
  if (hexColor == null) return null;
  hexColor = hexColor.toUpperCase().replaceAll('#', '');
  if (hexColor.length != 6) return null;
  return Color(int.parse('0xFF$hexColor'));
}