weekend static method

Validator<String> weekend({
  1. String? error,
})

Implementation

static Validator<String> weekend({String? error}) => (value, context) {
      final DateTimeResource? datetimeResource = context.resources.tryGet(
        'datetimeResource',
      );
      if (datetimeResource == null) {
        return (false, context.warnings.dateTimeResourceNotFound());
      }
      if (datetimeResource.isWeekend()) return (true, null);
      return (false, error ?? context.errors.stringDateErrors.weekend());
    };