in lib/src/stream_queue.dart [437:456]
Stream<T> _extractStream() {
assert(_isClosed);
if (_isDone) {
return Stream<T>.empty();
}
_isDone = true;
var subscription = _subscription;
if (subscription == null) {
return _source;
}
_subscription = null;
var wasPaused = subscription.isPaused;
var result = SubscriptionStream<T>(subscription);
// Resume after creating stream because that pauses the subscription too.
// This way there won't be a short resumption in the middle.
if (wasPaused) subscription.resume();
return result;
}