fileSize static method
Validates file size (in bytes).
Implementation
static String? fileSize(int? sizeBytes, {int? minSize, int? maxSize, String? fieldName}) {
if (sizeBytes == null) return null;
if (minSize != null && sizeBytes < minSize) {
return '${fieldName ?? "File"} must be at least ${_formatFileSize(minSize)}.';
}
if (maxSize != null && sizeBytes > maxSize) {
return '${fieldName ?? "File"} must not exceed ${_formatFileSize(maxSize)}.';
}
return null;
}