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 2026Releases
latest 51-
0.12.2027 Apr 2026Release notes
Open source →- Allow exceptions from
operator ==to bubble up and fail the test instead of
treating them as unequal objects.
Release notes
Open source →- Allow exceptions from
operator ==to bubble up and fail the test instead of treating them as unequal objects. - Require Dart 3.11
- Allow exceptions from
-
0.12.1927 Feb 2026Release notes
Open source →- Improve speed of pretty printing for large collections.
- Improve output of pairwiseCompare with mismatched types.
-
0.12.1820 Nov 2025Release notes
Open source →- Add
isSortedand related matchers for iterables. - Consider
NaNto be equal to itself inequals. - Remove some dynamic invocations.
- Add explicit casts from
dynamicvalues. - Require Dart 3.7
- Add
-
0.12.1718 Oct 2024 -
0.12.1602 May 2023Release notes
Open source →- Expand bounds on
test_apidependency to allow the next breaking release which will remove the cyclic dependency on this package.
- Expand bounds on
-
0.12.16+113 Dec 2023 -
0.12.1522 Mar 2023Release notes
Open source →- Add
package:matcher/expect.dartlibrary. Copies the implementation ofexpectand the asynchronous matchers frompackage:test.
- Add
-
0.12.1413 Dec 2022Release notes
Open source →- Add
containsOncematcher. - Deprecate
isCyclicInitializationErrorandNullThrownError. These errors will be removed from the SDK. Update them to catch more general errors.
- Add
-
0.12.1325 Oct 2022Release notes
Open source →- Require Dart 2.17 or greater.
- Make
isCastErrorno longer depend on the deprecatedCastErrortype. - Annotate
TypeMatcher.havingwithuseResult.
-
0.12.1215 Jun 2022Release notes
Open source →- Add a best practices section to readme.
- Populate the pubspec
repositoryfield.
-
0.12.1112 Aug 2021Release notes
Open source →- Change many argument types from
dynamictoObject?. - Fix
stringContainsInOrderto account for repetitions and empty strings.- Note: This may break some existing tests, as the behavior does change.
- Change many argument types from
-
0.12.1002 Feb 2021 -
0.12.10-nullsafety.303 Nov 2020 pre-releaseRelease notes
Open source →- Update SDK constraints to
>=2.12.0-0 <3.0.0based on beta release guidelines.
- Update SDK constraints to
-
0.12.10-nullsafety.223 Oct 2020 pre-release -
0.12.10-nullsafety.122 Sep 2020 pre-release -
0.12.10-nullsafety29 Jul 2020 pre-releaseRelease notes
Open source →- Migrate to NNBD.
- Apis have been updated to express intent of the existing code and how it handled nulls.
- Migrate to NNBD.
-
0.12.913 Jul 2020Release notes
Open source →- 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.
-
0.12.816 Jun 2020 -
0.12.621 Oct 2019Release notes
Open source →- Update minimum Dart SDK to
2.2.0. - Consistently point to
isAas a replacement forinstanceOf. - Pretty print with private type names.
- Update minimum Dart SDK to
-
0.12.522 Mar 2019Release notes
Open source →- Add
isA()to createTypeMatcherinstances 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
greaterThannow compares with the>operator rather not<and not=. This could cause tests which relied on this bug to start failing.
- Add
-
0.12.417 Jul 2018 -
0.12.314 Jun 2018Release notes
Open source →-
Many improvements to
TypeMatcher-
Can now be used directly as
const TypeMatcher<MyType>(). -
Added a type parameter to specify the target
Type.- Made the
nameconstructor parameter optional and marked it deprecated. It's redundant to the type parameter.
- Made the
-
Migrated all
isTypematchers toTypeMatcher. -
Added a
havingfunction 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
isInstanceOfclass. UseTypeMatcherinstead. -
Improved the output of
Matcherinstances that fail due to type errors.
-
-
0.12.3+116 Jul 2018 -
0.12.212 Apr 2018Release notes
Open source →-
Fixed
unorderedMatchesin 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.
-
-
0.12.2+103 May 2018 -
0.12.105 May 2017 -
0.12.1+127 May 2017 -
0.12.1+230 Aug 2017Release notes
Open source →-
Fixed small documentation issues.
-
Fixed small issue in
StringEqualsMatcher. -
Update to support future Dart language changes.
-
-
0.12.1+305 Sep 2017Release notes
Open source →-
Make
predicateandpairwiseComparegeneric 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.
-
-
0.12.1+420 Sep 2017 -
0.12.030 Apr 2015Release notes
Open source →-
Moved a number of members to the
unittestpackage.TestFailure,ErrorFormatter,expect,fail, and 'wrapAsync'.completes,completion,throws, andthrowsAMatchers.- The
Throwsclass. - All of the
throws...ErrorMatchers.
-
Removed
FailureHandler,DefaultFailureHandler,configureExpectFailureHandler, andgetOrCreateExpectFailureHandler. Now thatexpectis in theunittestpackage, these are no longer needed. -
Removed the
nameparameter forisInstanceOf. This was previously deprecated, and is no longer necessary since all language implementations now support converting the type parameter to a string directly.
-
-
0.12.0+121 May 2015 -
0.12.0+224 Mar 2016 -
0.12.0-alpha.020 Feb 2015 pre-releaseNothing published for this version
-
0.11.413 Jan 2015Release notes
Open source →- Remove the type checks in the
isEmptyandisNotEmptymatchers and simply access theisEmptyrespectivelyisNotEmptyfields. This allows them to work with custom collections. See Issue 21792 and Issue 21562
- Remove the type checks in the
-
0.11.4+110 Feb 2015Release notes
Open source →- Correctly match and print
Strings containing characters that must be represented as escape sequences.
- Correctly match and print
-
0.11.4+205 Mar 2015Release notes
Open source →- Improve the formatting of strings that contain unprintable ASCII characters.
-
0.11.4+309 Mar 2015 -
0.11.4+424 Mar 2015Release notes
Open source →- Deprecate the name parameter to
isInstanceOf. All language implementations now support converting the type parameter to a string directly.
- Deprecate the name parameter to
-
0.11.4+524 Mar 2016 -
0.11.4+624 Mar 2016Release notes
Open source →- Fix a bug introduced in 0.11.4+5 in which operator matchers broke when taking lists of matchers.
-
0.11.310 Dec 2014 -
0.11.204 Dec 2014 -
0.11.131 Jul 2014 -
0.11.022 Jul 2014 -
0.10.112 Jun 2014 -
0.10.1+112 Jun 2014 -
0.10.022 Mar 2014Nothing published for this version
-
0.10.0+102 Jun 2014Release notes
Open source →-
Matchers related to bad language use have been removed. These represent code structure that should rarely or never be validated in tests.
isAbstractClassInstantiationErrorthrowsAbstractClassInstantiationErrorisFallThroughErrorthrowsFallThroughError
-
Added types to a number of method arguments.
-
The structure of the library and test code has been updated.
-
-
0.10.0+202 Jun 2014 -
0.10.0+305 Jun 2014