Single-subscription streams versus broadcast streams

The Dart stream framework supports the single-subscription and broadcast streams in order to have different approaches depending on the required solution. Let's see the difference between single-subscription and broadcast streams.

A single-subscription stream

A stream that allows you to have only one listener during the entire lifetime is called a single-subscription stream. You are not allowed to cancel and subscribe to the same stream again. The newly created stream starts generating events only after the subscription starts listening to them. It stops generating events after the subscription is canceled even if the stream can provide more. The single-subscription stream always delivers each ...

Get Dart: Scalable Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.