Matcher predicate(bool f(value), [ String description = 'satisfies function' ])

Returns a matcher that uses an arbitrary function that returns true or false for the actual value.

For example:

expect(v, predicate((x) => ((x % 2) == 0), "is even"))

Source

Matcher predicate(bool f(value), [String description = 'satisfies function']) =>
    new _Predicate(f, description);