6/25/2023 0 Comments Kotlin by lazy with parameterNevertheless there are still some questions left and we discussed here the problem of loading ViewModel data and evaluating various options.įrom my experience, I recommend the Lazy Map approach as I found it to be a nice balance of pros and cons and is really easy to adopt. Introducing Architecture Components significantly simplified Android development and solved many problems. ![]() However there is still some boilerplate left, therefore even if this could be “perfect” solution, other options might be more suitable for your team. At the same time we start to have problems with other dependencies and we need to figure out how to actually pass them into the factory together with parameters, creating even more boilerplate.Īssisted Injection is trying to solve this problem and Jake Wharton covered this topic in his talk at Droidcon London 2018. It requires extra code to hook into the ViewModelFactory in a way that we could pass dynamic parameters. ➕Whole public API is one method contacts() ➕ViewModel accepts parameters in constructor, immutable and nicely testable. ![]() ➖Not trivial to implement and understand, boilerplate needed.
0 Comments
Leave a Reply. |