- override
Request that the stream pauses events until further notice.
While paused, the subscription will not fire any events. If it receives events from its source, they will be buffered until the subscription is resumed. The underlying source is usually informed about the pause, so it can stop generating events until the subscription is resumed.
To avoid buffering events on a broadcast stream, it is better to cancel this subscription, and start to listen again when events are needed.
If resumeSignal
is provided, the stream will undo the pause
when the future completes. If the future completes with an error,
the stream will resume, but the error will not be handled!
A call to resume
will also undo a pause.
If the subscription is paused more than once, an equal number of resumes must be performed to resume the stream.
Currently DOM streams silently drop events when the stream is paused. This is a bug and will be fixed.
Source
@override void pause([Future resumeSignal]) { _pauseCount++; if (resumeSignal != null) { resumeSignal.whenComplete(resume); } }