isHexadecimal function

bool isHexadecimal(
  1. String? value
)

Returns true if the value is a valid hexadecimal string

Implementation

bool isHexadecimal(String? value) {
  if (value == null) return false;
  final trimmed = value.trim();
  if (trimmed.isEmpty) return false;

  // Check if contains only hex characters (0-9, A-F, a-f)
  final hexRegex = RegExp(r'^[0-9A-Fa-f]+$');
  return hexRegex.hasMatch(trimmed);
}