toContain method

Return toContain(
  1. Object? expected
)

Returns a matcher that matches if the match argument contains the expected value.

For Strings this means substring matching; for Maps it means the map has the key, and for Iterables it means the iterable has a matching element. In the case of iterables, expected can itself be a matcher.

expect('Hello world').toContain('Hello');
expect([1,2]).toContain(2);
expect({  'hello': 'world' }).toContain('hello');

Implementation

Return toContain(Object? expected) {
  return runMatcher(dart_test.contains(expected));
}