hexStringToColor function
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'));
}