isOneOf<T> function
Checks whether the given value is one of the options
values of type T
Implementation
IValidator isOneOf<T>(Iterable<T> options, {String? message}) {
return Validator(
(value) => Result(
isValid: options.contains(value),
expectation: Expectation(
message: message ?? 'one of: ${prettifyValue(options)}',
value: value,
code: ExpectationCodes.valueMembershipMismatch,
data: {'options': options.map((e) => e.toString()).toList()},
),
value: value,
),
);
}