Max
06/23/2024, 10:23 AMkoinInject()
inside a Composable is expensive?
Let’s say I have a LazyList
with 100 elements. Each list item is a Composable. Should I pass an instance of my needed Singleton to the Composable, or is it no overhead to lookup the Singleon via koinInject()
inside the list item Composable?Stylianos Gakis
06/23/2024, 11:17 AMFarhazul Mullick
06/24/2024, 4:13 AMkoinInject
. But if its factory you should rather pass itlesincs
06/24/2024, 5:18 AMFarhazul Mullick
06/24/2024, 5:33 AMlesincs
06/24/2024, 5:40 AMMax
06/24/2024, 3:56 PMremember
and performs a lookup of the requested instance. The lookup seems like a bit overhead to me.
I agree with all the comments, I should refactor my code and pass all instances down, also for Previews 👍