isValidInput method

  1. @override
bool isValidInput(
  1. String input
)
override

Optional method to validate if input can be processed by this codec.

input The string to validate. Returns true if the input is valid for this codec, false otherwise.

Implementation

@override
bool isValidInput(String input) {
  if (input.isEmpty) return false;

  // Check if string contains only valid hex characters and has even length
  final hexPattern = RegExp(r'^[0-9A-Fa-f]*$');
  return hexPattern.hasMatch(input) && input.length % 2 == 0;
}