pause method

void pause ([Future resumeSignal ])

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. For non-broadcast streams, 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 the intermediate events are not important.

If resumeSignal is provided, the stream subscription will undo the pause when the future completes, as if by a call to resume. If the future completes with an error, the stream will still resume, but the error will be considered unhandled and is passed to Zone.handleUncaughtError.

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.

Implementation

void pause([Future resumeSignal]);