passes method
Validates the value using the given context.
Returns true if valid, otherwise false.
Implementation
@override
FutureOr<bool> passes(ValidationContext context) async {
final value = context.value;
final args = context.parameters;
if (value == null || args.isEmpty) return false;
if (!await FileRule().passes(context)) return false;
final maxKB = int.tryParse(args[0]);
if (maxKB == null) return false;
final maxBytes = maxKB * 1024;
if (value is UploadedFile) {
return value.size <= maxBytes;
}
if (value is List<UploadedFile>) {
return value.every((file) => file.size <= maxBytes);
}
return true;
}