close method Null safety

  1. @override
Future<void> close()
override

Closes the group, indicating that no more streams will be added.

If there are no streams in the group, stream is closed immediately. Otherwise, stream will close once all streams in the group close.

Returns a Future that completes once stream has actually been closed.

Implementation

@override
Future<void> close() {
  if (_closed) return _controller.done;

  _closed = true;
  if (_subscriptions.isEmpty) _controller.close();

  return _controller.done;
}