contains method

void contains(
  1. T element
)

Expects that the iterable contains element according to Iterable.contains.

Implementation

void contains(T element) {
  context.expect(() {
    return prefixFirst('contains ', literal(element));
  }, (actual) {
    if (actual.isEmpty) return Rejection(actual: ['an empty iterable']);
    if (actual.contains(element)) return null;
    return Rejection(
        which: prefixFirst('does not contain ', literal(element)));
  });
}