Skip to content

make AsyncMatcher public or create AsyncCustomMatcher to support custom, async matchers #2464

Open
@StephenWithPH

Description

@StephenWithPH

It would be nice if this interface:

/// A matcher that does asynchronous computation.
///
/// Rather than implementing [matches], subclasses implement [matchAsync].
/// [AsyncMatcher.matches] ensures that the test doesn't complete until the
/// returned future completes, and [expect] returns a future that completes when
/// the returned future completes so that tests can wait for it.
abstract class AsyncMatcher extends Matcher {

... was either directly exposed in the package's public API or exposed via a new AsyncCustomMatcher whose use would closely follow https://pub.dev/documentation/matcher/latest/matcher/CustomMatcher-class.html.

For reference, there are cases in Flutter where the current, non-exported AsyncMatcher is used: https://github.com/search?q=repo%3Aflutter%2Fflutter+%22package%3Amatcher%2Fsrc%2Fexpect%2Fasync_matcher.dart%22&type=code

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions