Open Conrad33 opened 2 years ago
You can check my library: https://github.com/hoc081098/rxdart_ext#3-statestream
This seems like it could work, but why does StateSubject.stream return a regular Stream instead of a ValueStream? Is the only way to get the latest value synchronously to use the StateSubject object itself? This means I would have to update the type annotations of the code that uses this.
Thanks for pointing that, it seem to be a bug.
Ok, that'll work then when that is fixed. On a side note, is there a reason this isn't available out of the box with regular Rx dart?
I encountered the same issue 2 years ago when using Flutter & StreamBuilder, I wrote and published distinct_value_connectable_stream.
Recently, I merged it to rxdart_ext
and rename DistinctValue
to State
(inspired by Kotlinx Coroutines StateFlow).
On a side note, is there a reason this isn't available out of the box with regular Rx.
Because StateSubject
is not a standard Subject in ReactiveX (includes: PublishSubject
, BehaviorSubject
, AsyncSubject
, ReplaySubject
).
So I decided to publish it in another package (rxdart_ext
) :)).
I'm afraid including it in rxdart
may confuse many users.
I'm pretty new to this Dart stream stuff so maybe I'm missing something. But, is it possible to have a distinct ValueStream? The distinct method of the ValueStream class returns a regular Stream. I would like to have a distinct stream that I can synchronously grab the last item out of.