isIn function Null safety

Matcher isIn(
  1. Object? expected
)

Returns a matcher that matches if the match argument is in the expected value. This is the converse of contains.

Implementation

Matcher isIn(Object? expected) {
  if (expected is Iterable) {
    return _In(expected, expected.contains);
  } else if (expected is String) {
    return _In<Pattern>(expected, expected.contains);
  } else if (expected is Map) {
    return _In(expected, expected.containsKey);
  }

  throw ArgumentError.value(
      expected, 'expected', 'Only Iterable, Map, and String are supported.');
}