validateHexColor function
Returns error message if not valid hex color, null if valid
Implementation
String? Function(dynamic) validateHexColor({String? failMessage}) {
return (dynamic value) {
if (!isHexColor(value)) {
return failMessage ?? 'This field must be a valid hex color (e.g., #FF0000, #F00, #FF0000FF)';
}
return null;
};
}