validateBase64 method

void validateBase64(
  1. String field,
  2. String value
)
inherited

Validate base64 format.

Implementation

void validateBase64(String field, String value) {
  try {
    final decoded = base64Decode(value.replaceAll(RegExp(r'\s+'), ''));
    if (decoded.isEmpty) {
      throw const FormatException('Empty base64 string');
    }
  } catch (e) {
    throw JupiterValidationException(
      'Invalid base64 format for "$field"',
      field: field,
      error: e,
    );
  }
}