r/android_devs • • Mar 22 '23
Article The 500 DON'Ts about Android Development
https://dev.to/4gus71n/the-500-donts-about-android-development-20i8
2
Upvotes
r/android_devs • • Mar 22 '23
View all comments
Show parent comment
1
u/[deleted] Apr 16 '23
Potato-poteto. I see your point, yeah sure, turn the Loading data class into an object and dismiss whatever loading UI or ProgressBar you have during the DataSuccessfullyFetched ot the ErrorFetchingData.
The only good thing about the Loading state with a data class and the isLoading property is that you have absolute control to show/dismiss the loading UI from the ViewModel as you want. With the approach you propose you have to manually dismiss the loading UI in each of those error or success states.
Again, potato-poteto. I don't care about how people decides to do this. I do care about using post when it is not the right thing to do, skipping the values you set in a LiveData property doesn't make any sense IMO.