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;

  // Basic Base64 validation
  final base64Pattern = RegExp(r'^[A-Za-z0-9+/]*={0,2}$');
  return base64Pattern.hasMatch(input) && input.length % 4 == 0;
}