isOneOf<T> function

IEskValidator isOneOf<T>(
  1. List<T> options
)

Checks whether the given value is one of the options values of type T

Implementation

IEskValidator isOneOf<T>(List<T> options) => all([
      isType<T>(),
      EskValidator(
        (value) => EskResult(
          isValid: options.contains(value),
          error: 'one of: ${pretifyValue(options)}',
          value: value,
        ),
      ),
    ]);