contains<T> function
- T item
Checks whether the given value contains the item
value of type T
Works for iterables and strings
Implementation
IValidator contains<T>(T item) => Validator((value) {
if (hasContainsProperty(value)) {
return Result(
isValid: value.contains(item),
expectation: expectation('contains ${prettifyValue(item)}', value, null, 'value.contains_missing'),
value: value,
);
} else {
return expectation('${value.runtimeType} does not have a contains property', value, null, 'logic.predicate_failed')
.toInvalidResult();
}
});