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;

  try {
    // Try to decode as Base64 first
    final bytes = base64.decode(input);
    // Check if it starts with GZip magic number (1f 8b)
    return bytes.length >= 2 && bytes[0] == 0x1f && bytes[1] == 0x8b;
  } catch (e) {
    return false;
  }
}