StreamMatcher constructor
Creates a new StreamMatcher described by description
that matches
events with matchQueue
.
The matchQueue
callback is used to implement StreamMatcher.matchQueue,
and should follow all the guarantees of that method. In particular:
- If it matches successfully, it should return
null
and possibly consume events. - If it fails to match, consume no events and return a description of the failure.
- The description should be in past tense.
- The description should be grammatically valid when used after "the stream"—"emitted the wrong events", for example.
The matchQueue
callback may return the empty string to indicate a
failure if it has no information to add beyond the description of the
failure and the events actually emitted by the stream.
The description
should be in the subjunctive mood. This means that it
should be grammatically valid when used after the word "should". For
example, it might be "emit the right events".
Implementation
factory StreamMatcher(Future<String?> Function(StreamQueue) matchQueue,
String description) = _StreamMatcher;