remove method
Removes stream as a member of this group.
No further events from stream will be emitted through this group. If
stream has been listened to, its subscription will be canceled.
If stream has been listened to, this synchronously cancels its
subscription. This means that any events from stream that haven't yet
been emitted through this group will not be.
If stream's subscription is canceled, this returns
StreamSubscription.cancel's return value. Otherwise, it returns null.
Implementation
Future<void>? remove(Stream<T> stream) {
var subscription = _subscriptions.remove(stream);
var future = subscription?.cancel();
if (_subscriptions.isEmpty) {
_onIdleController?.add(null);
if (_closed) {
_onIdleController?.close();
scheduleMicrotask(_controller.close);
}
}
return future;
}