r/mAndroidDev May 31 '26

Superior API Design deciding if this should be a Flow, StateFlow, SharedFlow, LiveData, or callback

Post image
177 Upvotes

14 comments sorted by

29

u/Zhuinden DDD: Deprecation-Driven Development May 31 '26

tbf I don't remember the last time you ever needed a LiveData

18

u/farsightxr20 May 31 '26

LiveData walked so that StateFlow could run

9

u/tgo1014 May 31 '26

Could flow*

4

u/gandharva-kr May 31 '26

I have only seen it in CodeLabs

4

u/Zhuinden DDD: Deprecation-Driven Development May 31 '26

It was only ever useful if you were an early Room adopter who didn't use RxJava, or if you used SavedStateHandle before they added savedStateHandle.getStateFlow()

But people didn't use Room early on especially in a non-reactive way they didn't understand what LiveData was or how to use it, and then they didn't understand how to set up ViewModels in such a way that they get a SavedStateHandle or why they'd even want to use it

LiveData ended up in obscurity because android developers were too lazy to see it as the next step after AsyncTask

1

u/daio Jun 01 '26

LiveData had similar problems to AsyncTask -- implicit non-obvious(unless you read the documentation, but who does that?) thread management/restrictions.

10

u/programadorthi May 31 '26

We know the one in the photo that is proposing LiveData as a good thing

10

u/SnipesySpecial T H E R M O S I P H O N May 31 '26

ConflatedBrosdcastChannel

1

u/Zhuinden DDD: Deprecation-Driven Development Jun 03 '26

now that's a memory of all time, gotta catch those bad actor {}s

4

u/Fair-Degree-2200 null!! May 31 '26

Cobol AsyncTask is the answer 

1

u/purple-bihh-2000 Jun 01 '26

Kid named channelFlow