Open mahmed1987 opened 1 month ago
For now we can handle scope creation by field: https://insert-koin.io/docs/reference/koin-android/scope#viewmodel-scope-since-354
Another solution is in study for 3.6
yeah @arnaudgiuliani , this appears to be quite necessary to have dependencies injected that are scoped to the ViewModel itself , and not single<> (kinda like what ScopedViewModel does , but yeah would want to do that in a normal androidx.ViewModel)
A use case can be for example a facility to sort a student list in a StudentViewModel called StudentSorter(). The StudentSorter class doesn't need to survive StudentViewModel death.
Great to know that this is in the radar .
I want to introduce a dependency in my ViewModel that is tied to the ViewModel (its life and death should work with the life and death of the ViewModel)
This code (copied from the official koin resource) works
However this is not what I want to achieve , I want to inject the Session class as a Constructor argument like this
The above responds with the exception stating that the Session bean could not be found.
What am i missing here ?
Koin Version - 3.5.0