isHexString function
Checks if a string contains only hexadecimal characters.
Validates that the input string contains only valid hexadecimal
characters (0-9, a-f, A-F) with no other content.
Parameters:
inputThe string to validate
Returns: true if the string is valid hexadecimal, false otherwise
Example:
isHexString("1a2b3c"); // Returns true
isHexString("ABCDEF"); // Returns true
isHexString("xyz123"); // Returns false
isHexString("12 34"); // Returns false
Implementation
bool isHexString(String input) {
// Check if string contains only hex characters (0-9, a-f, A-F)
final hexRegExp = RegExp(r'^[0-9a-fA-F]+$');
return hexRegExp.hasMatch(input);
}