PackageTrack
Sign in Get early access

matcher

Support for specifying test expectations via an extensible Matcher class. Also includes a number of built-in Matcher implementations for common cases.

0.12.20 10.0M downloads/mo #27 most downloaded on pub.dev dart-lang/test

What this package is like to depend on

Last release 3 months ago

27 Apr 2026

Ships fairly regularly

a new release about every 4 months

Nearly every release is documented

notes for 45 of 46 stable releases

Nothing withdrawn

no release was ever pulled

12 years old

51 releases · first in 2014

3 releases in the last 12 months

see the full history below

Release timeline

51 releases · Mar 2014 to Apr 2026
2015 2017 2019 2021 2023 2025
Release Pre-release

Releases

latest 51
  1. 0.12.20 27 Apr 2026
    Release notes
    • Allow exceptions from operator == to bubble up and fail the test instead of
      treating them as unequal objects.
    Open source →
    Release notes
    • Allow exceptions from operator == to bubble up and fail the test instead of treating them as unequal objects.
    • Require Dart 3.11
    Open source →
  2. 0.12.19 27 Feb 2026
    Release notes
    • Improve speed of pretty printing for large collections.
    • Improve output of pairwiseCompare with mismatched types.
    Open source →
  3. 0.12.18 20 Nov 2025
    Release notes
    • Add isSorted and related matchers for iterables.
    • Consider NaN to be equal to itself in equals.
    • Remove some dynamic invocations.
    • Add explicit casts from dynamic values.
    • Require Dart 3.7
    Open source →
  4. 0.12.17 18 Oct 2024
    Release notes
    • Require Dart 3.4
    • Move to dart-lang/test monorepo.
    Open source →
  5. 0.12.16 02 May 2023
    Release notes
    • Expand bounds on test_api dependency to allow the next breaking release which will remove the cyclic dependency on this package.
    Open source →
  6. 0.12.16+1 13 Dec 2023
    Release notes
    • Require Dart 3.0
    • Support latest version of package:test_api.
    Open source →
  7. 0.12.15 22 Mar 2023
    Release notes
    • Add package:matcher/expect.dart library. Copies the implementation of expect and the asynchronous matchers from package:test.
    Open source →
  8. 0.12.14 13 Dec 2022
    Release notes
    • Add containsOnce matcher.
    • Deprecate isCyclicInitializationError and NullThrownError. These errors will be removed from the SDK. Update them to catch more general errors.
    Open source →
  9. 0.12.13 25 Oct 2022
    Release notes
    • Require Dart 2.17 or greater.
    • Make isCastError no longer depend on the deprecated CastError type.
    • Annotate TypeMatcher.having with useResult.
    Open source →
  10. 0.12.12 15 Jun 2022
    Release notes
    • Add a best practices section to readme.
    • Populate the pubspec repository field.
    Open source →
  11. 0.12.11 12 Aug 2021
    Release notes
    • Change many argument types from dynamic to Object?.
    • Fix stringContainsInOrder to account for repetitions and empty strings.
      • Note: This may break some existing tests, as the behavior does change.
    Open source →
  12. 0.12.10 02 Feb 2021
    Release notes
    • Stable release for null safety.
    Open source →
  13. 0.12.10-nullsafety.3 03 Nov 2020 pre-release
    Release notes
    • Update SDK constraints to >=2.12.0-0 <3.0.0 based on beta release guidelines.
    Open source →
  14. 0.12.10-nullsafety.2 23 Oct 2020 pre-release
    Release notes
    • Allow prerelease versions of the 2.12 sdk.
    Open source →
  15. 0.12.10-nullsafety.1 22 Sep 2020 pre-release
    Release notes
    • Allow 2.10 stable and 2.11.0 dev SDK versions.
    Open source →
  16. 0.12.10-nullsafety 29 Jul 2020 pre-release
    Release notes
    • Migrate to NNBD.
      • Apis have been updated to express intent of the existing code and how it handled nulls.
    Open source →
  17. 0.12.9 13 Jul 2020
    Release notes
    • Improve mismatch descriptions for deep matches. Previously, if the user tried to do a deep match where the expectation included a complex matcher (such as a "having" matcher), the failure message would just say "failed to match ..."; it wouldn't call on the expectation's matcher to explain why the match failed.
    Open source →
  18. 0.12.8 16 Jun 2020
    Release notes
    • Add a mismatch description to TypeMatcher.
    Open source →
  19. 0.12.6 21 Oct 2019
    Release notes
    • Update minimum Dart SDK to 2.2.0.
    • Consistently point to isA as a replacement for instanceOf.
    • Pretty print with private type names.
    Open source →
  20. 0.12.5 22 Mar 2019
    Release notes
    • Add isA() to create TypeMatcher instances in a more fluent way.
    • Potentially breaking bug fix. Ordering matchers no longer treat objects with a partial ordering (such as NaN for double values) as if they had a complete ordering. For instance greaterThan now compares with the > operator rather not < and not =. This could cause tests which relied on this bug to start failing.
    Open source →
  21. 0.12.4 17 Jul 2018
    Release notes
    • Add isCastError.
    Open source →
  22. 0.12.3 14 Jun 2018
    Release notes
    • Many improvements to TypeMatcher

      • Can now be used directly as const TypeMatcher<MyType>().

      • Added a type parameter to specify the target Type.

        • Made the name constructor parameter optional and marked it deprecated. It's redundant to the type parameter.
      • Migrated all isType matchers to TypeMatcher.

      • Added a having function that allows chained validations of specific features of the target type.

        /// 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);
        
    • Deprecated the isInstanceOf class. Use TypeMatcher instead.

    • Improved the output of Matcher instances that fail due to type errors.

    Open source →
  23. 0.12.3+1 16 Jul 2018
    Release notes
    • Set max SDK version to <3.0.0, and adjusted other dependencies.
    Open source →
  24. 0.12.2 12 Apr 2018
    Release notes
    • Fixed unorderedMatches in cases where the matchers may match more than one element and order of the elements doesn't line up with the order of the matchers.

    • Add containsAll matcher for Iterables. This Matcher checks that all values/matchers in an expected iterable are satisfied by an element in the value without allowing the same value to satisfy multiple matchers.

    Open source →
  25. 0.12.2+1 03 May 2018
    Release notes
    • Updated SDK version to 2.0.0-dev.17.0
    Open source →
  26. 0.12.1 05 May 2017
    Release notes
    • Add containsAllInOrder matcher for Iterables
    Open source →
  27. 0.12.1+1 27 May 2017
    Release notes
    • Produce a better error message when a CustomMatcher's feature throws.
    Open source →
  28. 0.12.1+2 30 Aug 2017
    Release notes
    • Fixed small documentation issues.

    • Fixed small issue in StringEqualsMatcher.

    • Update to support future Dart language changes.

    Open source →
  29. 0.12.1+3 05 Sep 2017
    Release notes
    • Make predicate and pairwiseCompare generic methods to allow typed functions to be passed to them as arguments.

    • Make internal implementations take better advantage of type promotion to avoid dynamic call overhead.

    Open source →
  30. 0.12.1+4 20 Sep 2017
    Release notes
    • Fixed SDK constraint to allow edge builds.
    Open source →
  31. 0.12.0 30 Apr 2015
    Release notes
    • Moved a number of members to the unittest package.

      • TestFailure, ErrorFormatter, expect, fail, and 'wrapAsync'.
      • completes, completion, throws, and throwsA Matchers.
      • The Throws class.
      • All of the throws...Error Matchers.
    • Removed FailureHandler, DefaultFailureHandler, configureExpectFailureHandler, and getOrCreateExpectFailureHandler. Now that expect is in the unittest package, these are no longer needed.

    • Removed the name parameter for isInstanceOf. This was previously deprecated, and is no longer necessary since all language implementations now support converting the type parameter to a string directly.

    Open source →
  32. 0.12.0+1 21 May 2015
    Release notes
    • Fix test files to use test instead of unittest pkg.
    Open source →
  33. 0.12.0+2 24 Mar 2016
    Release notes
    • Fix all strong-mode warnings.
    Open source →
  34. 0.12.0-alpha.0 20 Feb 2015 pre-release

    Nothing published for this version

  35. 0.11.4 13 Jan 2015
    Release notes
    • Remove the type checks in the isEmpty and isNotEmpty matchers and simply access the isEmpty respectively isNotEmpty fields. This allows them to work with custom collections. See Issue 21792 and Issue 21562
    Open source →
  36. 0.11.4+1 10 Feb 2015
    Release notes
    • Correctly match and print Strings containing characters that must be represented as escape sequences.
    Open source →
  37. 0.11.4+2 05 Mar 2015
    Release notes
    • Improve the formatting of strings that contain unprintable ASCII characters.
    Open source →
  38. 0.11.4+3 09 Mar 2015
    Release notes
    • Fix the examples for equalsIgnoringWhitespace.
    Open source →
  39. 0.11.4+4 24 Mar 2015
    Release notes
    • Deprecate the name parameter to isInstanceOf. All language implementations now support converting the type parameter to a string directly.
    Open source →
  40. 0.11.4+5 24 Mar 2016
    Release notes
    • Fix all strong-mode warnings.
    Open source →
  41. 0.11.4+6 24 Mar 2016
    Release notes
    • Fix a bug introduced in 0.11.4+5 in which operator matchers broke when taking lists of matchers.
    Open source →
  42. 0.11.3 10 Dec 2014
    Release notes
    • Add a prints matcher that matches output a callback emits via print.
    Open source →
  43. 0.11.2 04 Dec 2014
    Release notes
    • Add an isNotEmpty matcher.
    Open source →
  44. 0.11.1 31 Jul 2014
    Release notes
    • Added isNaN and isNotNaN matchers.
    Open source →
  45. 0.11.0 22 Jul 2014
    Release notes
    • Removed deprecated matchers.
    Open source →
  46. 0.10.1 12 Jun 2014
    Release notes
    • Compare sets order-independently when using equals().
    Open source →
  47. 0.10.1+1 12 Jun 2014
    Release notes
    • Get the tests passing when run on dart2js in minified mode.
    Open source →
  48. 0.10.0 22 Mar 2014

    Nothing published for this version

  49. 0.10.0+1 02 Jun 2014
    Release notes
    • Matchers related to bad language use have been removed. These represent code structure that should rarely or never be validated in tests.

      • isAbstractClassInstantiationError
      • throwsAbstractClassInstantiationError
      • isFallThroughError
      • throwsFallThroughError
    • Added types to a number of method arguments.

    • The structure of the library and test code has been updated.

    Open source →
  50. 0.10.0+2 02 Jun 2014
    Release notes
    • Added types to a number of constants.
    Open source →
  51. 0.10.0+3 05 Jun 2014
    Release notes
    • Removed @deprecated annotation on matchers due to Issue 19173
    Open source →

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive