-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.library-asynctype-documentationA request to add or improve documentationA request to add or improve documentationtype-questionA question about expected behavior or functionalityA question about expected behavior or functionality
Description
According to Stream.multi documentation
Line 398 in 0342791
| /// Creates a multi-subscription stream. |
It's not quite true in the case when a source of MultiStreamController.addStream() is a single-subscription stream. For example:
main() {
var source = StreamController<int>();
source.add(1);
source.add(2);
source.add(3);
source.close();
var stream = Stream<int>.multi((controller) {
controller.addStream(source.stream).then((_) {
controller.close();
});
});
listen(stream);
listen(stream); // Bad state: Stream has already been listened to.
}
void listen(Stream<int> stream) {
int eventsCounter = 1;
stream.listen((v) {
Expect.equals(eventsCounter++, v);
}, onDone: () {
Expect.equals(4, eventsCounter);
});
}Is this expected? If yes, then, probably, it makes sense to reflect it in the Stream.multi() constructor documentation.
cc @lrhn
Metadata
Metadata
Assignees
Labels
area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.library-asynctype-documentationA request to add or improve documentationA request to add or improve documentationtype-questionA question about expected behavior or functionalityA question about expected behavior or functionality