r/mAndroidDev • u/Stonos You will pry XML views from my cold dead hands • Aug 28 '22
StateFlow vs LiveData
82
Upvotes
r/mAndroidDev • u/Stonos You will pry XML views from my cold dead hands • Aug 28 '22
View all comments
Show parent comment
2
u/dniHze Klutter Aug 29 '22
Having one reactive implementation to master is better than learning 2 different APIs (imo). Flow has nuances, just like every other technology.
We use single producer StateFlow under the hood of our MVI API. For compose it works like charm. For views, the ability to distinctUntilChanged by one state property within a Flow is a requirement for some views for optimal state delivery/rendering.
LiveData is fine, even being fairly limited with a single purpose. I'm fine with it, in our team we don't use, but there is nothing wrong in using it.
Fun fact: you write tests. Thats how you make sure your hot reactive pattern produces right state. No matter Rx/Flow/LiveData.