https://kotlinlang.org logo
#getting-started
Title
# getting-started
a

Apparao Mulpuri

01/27/2023, 1:17 PM
Hi, What is the best equivalent to remove RxJava from the existing Android project? I am using StateFlow to replace the BehaviorSubject and SharedFlow to replace the PublishSubject. Unfortunately, the sequence emits are not working as expected.
c

CLOVIS

01/27/2023, 1:19 PM
Explain what exactly is not working as expected in #flow 🙂
a

Apparao Mulpuri

01/27/2023, 1:31 PM
If List values are updated, It's not updating in collectLatest for StateFlow
c

CLOVIS

01/27/2023, 1:32 PM
You'll need to provide more information than that, like a small example
p

psh

01/27/2023, 2:18 PM
One difference between Rx and Flow, and this might he what you are seeing -
Note that any instance of StateFlow already behaves as if
distinctUntilChanged
operator is applied to it, so applying
distinctUntilChanged
to a
StateFlow
has no effect. See StateFlow documentation on Operator Fusion. Also, repeated application of
distinctUntilChanged
operator on any flow has no effect.
(from https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/distinct-until-changed.html )
2 Views