concept custom matcher in category dart

appears as: custom matcher, custom matchers
Dart in Action

This is an excerpt from Manning's book Dart in Action.

3.4.3. Creating a custom matcher

Creating a custom matcher is a matter of extending the provided BaseMatcher class. We’ll look more at extending classes in chapters 6 and 7, but to extend the base matcher, you can create a class that provides two functions: a matches() function and a describe() function. The matches() function returns a bool value depending on whether the expectation was matched. The following listing shows a custom matcher class that validates whether two different PackItems contain the equivalent itemText value.