equals function

Matcher equals(
  1. Object? expected,
  2. [int limit = 100]
)

Returns a matcher that matches if the value is structurally equal to expected.

If expected is a Matcher, then it matches using that. Otherwise it tests for equality using == on the expected value.

For Iterables and Maps, this will recursively match the elements. To handle cyclic structures a recursion depth limit can be provided. The default limit is 100. Sets will be compared order-independently.

Implementation

Matcher equals(Object? expected, [int limit = 100]) => expected is String
    ? _StringEqualsMatcher(expected)
    : _DeepMatcher(expected, limit);