onIdle property

Stream onIdle

A broadcast stream that emits an event whenever this group becomes idle.

A FutureGroup is idle when it contains no futures, which is the case for a newly created group or one where all added futures have been removed or completed.

This stream will close when this group is idle and close has been called.

Events are delivered asynchronously, so it's possible for the group to become active again before the event is delivered.

Implementation

Stream get onIdle =>
    (_onIdleController ??= StreamController.broadcast(sync: true)).stream;