mayEmit function Null safety

StreamMatcher mayEmit(
  1. dynamic matcher

Returns a StreamMatcher that allows (but doesn't require) matcher to match the stream.

This matcher always succeeds; if matcher doesn't match, this just consumes no events.


StreamMatcher mayEmit(matcher) {
  var streamMatcher = emits(matcher);
  return StreamMatcher((queue) async {
    await queue.withTransaction(
        (copy) async => (await streamMatcher.matchQueue(copy)) == null);
    return null;
  }, 'maybe ${streamMatcher.description}');