Hi, thanks for the note you are completely right. The thing is
Parameters is a data class in this example, therefore fortunately Kotlin solves this problem problem for us.
Definitely it is something to thing about when deciding on the key of the map though.
Hi Jose, thanks for the article 👍I actually find it a bit of a problem that people use
getValue method on LiveData for testing, because often no other code uses that method and therefore the test does not model the real use case leading to problems you write about. Therefore I completely agree with using the
observe method in tests.
Hi Claudio, and thanks.
I guess it might be a question of habit. I’m also often against many Kotlin usages, but I always keep asking myself if it is just because I’m not used to it or if it is truly awful :D
lazyMapcase I understand, maybe it could be a bit nicer, but I believe if it is taken…
Yeah, I’ve seen this on many places and is widely used, however as you mention introduces state. Plus there is some boilerplate.
Assisted Injection is trying to solve this basically generating the factory having a method
create(parameter) returning ViewModel, reducing boilerplate a bit…
Thanks for the ideas. Do you maybe have somewhere a code snippet how it would look like with koin to inject the parameters into ViewModel?
It would be nice to see it and possibly have it as another alternative to presented options.