Search categories, packages and repositories

Package detailsv0.12.20

matcher

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

AndroidiOSWebmacOSWindowsLinux
30-day downloads
13.3M
Likes
68
Pub points
150

Install package

flutter pub add matcher

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The matcher package provides a flexible and extensible framework for defining test expectations in Dart. It includes a rich set of built-in matchers for common assertions, such as equality, type checks, and collection comparisons. Developers can also create custom matchers to express complex validation logic clearly and concisely. This package is integral to writing readable and maintainable tests using the Dart testing ecosystem.

Use cases

  • Writing unit tests with clear assertions
  • Validating complex object structures
  • Creating reusable test conditions
  • Testing collections and nested data
  • Extending test expectations with custom logic

Key features

  • Extensible Matcher class
  • Built-in matchers for common cases
  • Support for custom matcher creation
  • Clear error messages on failure
  • Integration with the Dart test framework

Suitable for

  • Dart developers writing unit and integration tests
  • Teams prioritizing readable test code
  • Projects using the `test` package
  • Developers needing expressive assertion syntax
  • Those building test utilities or frameworks

Considerations

  • Requires the `test` package for full functionality
  • Custom matchers require careful design for clarity
  • May add overhead if only basic equality checks are needed
  • Not intended for runtime validation outside tests
  • Limited standalone use without test context

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

Dart CI OpenSSF Scorecard

What's here?

Welcome! package:test is the standard testing library for Dart and Flutter. If you have questions about Dart testing, please see the docs for package:test. package:test_api and package:test_core are implementation details and generally not user-facing.

package:checks is a relatively new library for expressing test expectations. It's a more modern version of package:matcher and features a literate API.

Packages

Package Description Issues Version
checks A framework for checking values against expectations and building custom expectations. issues pub package
fake_async Fake asynchronous events such as timers and microtasks for deterministic testing. issues pub package
matcher Support for specifying test expectations via an extensible Matcher class. Also includes a number of built-in Matcher implementations for common cases. issues pub package
test A full featured library for writing and running Dart tests across platforms. issues pub package
test_api The user facing API for structuring Dart tests and checking expectations. pub package
test_core A basic library for writing tests and running them on the VM. pub package
test_descriptor An API for defining and verifying files and directory structures. issues pub package
test_process Test processes: starting; validating stdout and stderr; checking exit code. issues pub package

Categories

Dependencies

Dependency list 5 items

Source repository

Projects using this package