predicate<T> function

Matcher predicate <T>(bool f(T 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"))

Implementation

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