onIdle property Null safety

Stream onIdle

A broadcast stream that emits a null event whenever the last pending future in this group completes.

Once this group isn't waiting on any futures and close has been called, this stream will close.

Implementation

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