nullable function

Validator nullable(
  1. Validator validator
)

Allows the passed in validator to be nullable

Implementation

Validator nullable(Validator validator) {
  return (value) {
    if (value == null) return Result.valid;
    return validator(value);
  };
}