Vsevolod Kaganovych
08/11/2020, 11:42 AMwasyl
08/11/2020, 11:43 AMPublishSubject
is a BroadcastChannel<T>(1)
Dominaezzz
08/11/2020, 11:44 AMStateFlow
is the best available tool right now. SharedFlow
is more powerful and will be released within the next 2 months.wasyl
08/11/2020, 11:44 AMBehaviorSubject
can be replaced with a ConflatedBroadcastChannel
.Dominaezzz
08/11/2020, 11:46 AMSharedFlow
while you use BroadcastChannel(1)
.Vsevolod Kaganovych
08/11/2020, 11:48 AMJavier
08/11/2020, 12:00 PMBehaviorSubject
equivalent is StateFlow
when ConflatedBroadcastChannel
dissapearwasyl
08/11/2020, 12:02 PMStateFlow
is already released and working, I haven’t migrated to it myself yet. It’s a direct replacement for ConflatedBroadcastChannel(1)
, no (obvious) surprises right?Dominaezzz
08/11/2020, 12:03 PMwasyl
08/11/2020, 12:12 PMJavier
08/11/2020, 12:15 PMConflatedBroadcastChannel
when StateFlow
is releasedmateusz.kwiecinski
08/11/2020, 1:18 PMStateFlow
and ConflatedBroadcastChannel
In case when you set/emit the same value twice StateFlow won’t emit an update
https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-state-flow/conflation is based on equality like distinctUntilChanged operator, unlike conflation inStateFlow
that is based on reference identity.ConflatedBroadcastChannel
travis
08/11/2020, 4:30 PM