onIdle property

Stream<void> onIdle

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

A StreamGroup is idle when it contains no streams, which is the case for a newly created group or one where all added streams have been emitted done events (or been removed).

This stream will close when either:

  • This group is idle and close has been called, or
  • stream's subscription has been cancelled (if this is a single-subscription group).

Note that:

  • Events won't be emitted on this stream until stream has been listened to.
  • Events are delivered asynchronously, so it's possible for the group to become active again before the event is delivered.

Implementation

Stream<void> get onIdle =>
    (_onIdleController ??= StreamController.broadcast()).stream;