FLUTTER ECOSYSTEM

matcher

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

Latest version
0.12.20
30-day downloads
6.5M
Likes
66
Pub points
150

Package Overview

Selection guidance generated from public package information. For reference only.

Overview

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
Supported platformsAndroidiOSWebmacOSWindowsLinux

Install package

flutter pub add matcher

Categories

Source repository

Related projects