before static method
Implementation
static Validator<DateTime> before(DateTime date, {String? error}) => (
value,
context,
) {
final DateTimeResource datetimeResource = context.resources.getOrCreate(
value.toString(),
() => DateTimeResource(value),
);
if (datetimeResource.isBefore(date)) return (true, null);
return (
false,
error ?? context.errors.stringDateErrors.before(date.toString()),
);
};