isEq<T> function
- T otherValue
Checks whether the given value is equal to the otherValue
value of type T
Even though this function accepts any Type, note that it will not work with Collections. For that usecase prefer using isDeepEq instead.
Implementation
IValidator isEq<T>(T otherValue) =>
isType<T>() &
validator(
(value) => value == otherValue,
(value) => Expectation(
message: 'equal to ${prettifyValue(otherValue)}',
value: value,
code: 'value.equal_mismatch',
data: {
'expected': prettifyValue(otherValue),
'found': prettifyValue(value),
'mode': 'shallow'
},
),
);