Support for specifying test expectations, such as for unit tests.
The matcher library provides a third-generation assertion mechanism, drawing inspiration from Hamcrest.
For more information, see Unit Testing with Dart.
TypeMatcherinstances in a more fluent way.
greaterThannow compares with the
>operator rather not
=. This could cause tests which relied on this bug to start failing.
Many improvements to
Can now be used directly as
Added a type parameter to specify the target
nameconstructor parameter optional and marked it deprecated. It's redundant to the type parameter.
isType matchers to
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);
isInstanceOf class. Use
Improved the output of
Matcher instances that fail due to type errors.
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
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.
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.
Fixed small documentation issues.
Fixed small issue in
Update to support future Dart language changes.
CustomMatcher's feature throws.
Moved a number of members to the
fail, and 'wrapAsync'.
expect is in the
unittest package, these are no longer needed.
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.
isInstanceOf. All language implementations now support converting the type parameter to a string directly.
Strings containing characters that must be represented as escape sequences.
isNotEmptymatchers and simply access the
isNotEmptyfields. This allows them to work with custom collections. See Issue 21792 and Issue 21562
printsmatcher test on dart2js.
printsmatcher that matches output a callback emits via
Refactored libraries and tests.
Fixed spelling mistake.
@deprecatedannotation on matchers due to Issue 19173
Matchers related to bad language use have been removed. These represent code structure that should rarely or never be validated in tests.
Added types to a number of method arguments.
The structure of the library and test code has been updated.
Add this to your package's pubspec.yaml file:
dependencies: matcher: ^0.12.5
You can install packages from the command line:
$ pub get
$ flutter pub get
Alternatively, your editor might support
pub get or
flutter pub get.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
|0.12.5||Mar 22, 2019|
|0.12.4||Jul 17, 2018|
|0.12.3+1||Jul 16, 2018|
|0.12.3||Jun 14, 2018|
|0.12.2+1||May 3, 2018|
|0.12.2||Apr 12, 2018|
|0.12.1+4||Sep 20, 2017|
|0.12.1+3||Sep 5, 2017|
|0.12.1+2||Aug 30, 2017|
|0.12.1+1||May 27, 2017|
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
We analyzed this package on May 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: Flutter, web, other
No platform restriction found in primary library
lib/src/equals_matcher.dart. (-0.50 points)
lib/src/equals_matcher.dart reported 1 hint:
line 73 col 57: DO use curly braces for all flow control structures.
Maintain an example. (-10 points)
Create a short demo in the
example/ directory to show how to use this package.
Common filename patterns include
matcher.dart. Packages with multiple examples should provide
For more information see the pub package layout conventions.