File Validation Service
Component Detail
Service Layer
low complexity
mobile
0
Dependencies
1
Dependents
0
Entities
0
Integrations
Description
Performs client-side validation of selected files before upload begins, enforcing allowed MIME types (images and PDFs) and a configurable maximum file size limit. Returns structured validation results with user-facing error messages suitable for announcement via Flutter Semantics for WCAG 2.2 AA compliance.
file-validation-service
Responsibilities
- Validate file MIME type against the allowed list (image/jpeg, image/png, image/heic, application/pdf)
- Enforce configurable maximum file size before upload
- Return descriptive, accessible error messages for invalid files
- Support runtime configuration of allowed types and size limits
Interfaces
validateFile(File file)
isAllowedMimeType(String mimeType)
isWithinSizeLimit(int bytes)
getValidationError(File file)
getMaxFileSizeBytes()
getAllowedMimeTypes()