matches method

bool matches (dynamic item, Map matchState)
override

Does the matching of the actual vs expected values.

item is the actual value. matchState can be supplied and may be used to add details about the mismatch that are too costly to determine in describeMismatch.

Implementation

bool matches(item, Map matchState) {
  try {
    var f = featureValueOf(item);
    if (_matcher.matches(f, matchState)) return true;
    addStateInfo(matchState, {'custom.feature': f});
  } catch (exception, stack) {
    addStateInfo(matchState, {
      'custom.exception': exception.toString(),
      'custom.stack': new Chain.forTrace(stack)
          .foldFrames(
              (frame) =>
                  frame.package == 'test' ||
                  frame.package == 'stream_channel' ||
                  frame.package == 'matcher',
              terse: true)
          .toString()
    });
  }
  return false;
}