StateConnectableExtensions<T> extension

Provide two extension methods for Stream:

on

Methods

publishState(T seedValue, {Equality<T>? equals, bool sync = true}) StateConnectableStream<T>
Convert the this Stream into a StateConnectableStream that can be listened to multiple times, providing an initial seeded value. It will not begin emitting items from the original Stream until the connect method is invoked.
shareState(T seedValue, {Equality<T>? equals, bool sync = true}) StateStream<T>
Convert the this Stream into a new StateStream that can be listened to multiple times, providing an initial value. It will automatically begin emitting items when first listened to, and shut down when no listeners remain.