In<T> class

Validates that the value is contained in a given whitelist.

Mirrors Laravel's in:foo,bar,baz rule. Null values pass so you can combine with Required to enforce presence separately.

Validator.make({'visibility': 'public'}, {
  'visibility': [In<String>(['public', 'private'])],
});
Inheritance

Constructors

In(List<T> values)

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
values List<T>
The allowed values (immutable snapshot of the caller-provided list).
final

Methods

message() String
Get the validation error message.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
params() Map<String, dynamic>
Get the replacement parameters for the message.
override
passes(String attribute, dynamic value, Map<String, dynamic> data) bool
Determine if the validation rule passes.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited