contains<T> function

IEskValidator contains<T>(
  1. T item
)

Checks whether the given value contains the item value of type T

Works for iterables and strings

Implementation

IEskValidator contains<T>(T item) => EskValidator((value) {
      if (hasContainsProperty(value)) {
        return EskResult(
          isValid: value.contains(item),
          error: 'contains ${pretifyValue(item)}',
          value: value,
        );
      } else {
        return EskResult.invalid(
          '${value.runtimeType} does not have a length property',
          value,
        );
      }
    });