having method

  1. @useResult
TypeMatcher<T> having(
  1. Object? feature(
    1. T
  2. String description,
  3. dynamic matcher

Returns a new TypeMatcher that validates the existing type as well as a specific feature of the object with the provided matcher.

Provides a human-readable description of the feature to make debugging failures easier.

/// Validates that the object is a [RangeError] with a message containing
/// the string 'details' and `start` and `end` properties that are `null`.
final _rangeMatcher = isRangeError
   .having((e) => e.message, 'message', contains('details'))
   .having((e) => e.start, 'start', isNull)
   .having((e) => e.end, 'end', isNull);


TypeMatcher<T> having(
        Object? Function(T) feature, String description, dynamic matcher) =>
    HavingMatcher(this, description, feature, matcher);