sarthak sehgal
12/05/2023, 11:18 AMarnaud.giuliani
12/05/2023, 4:28 PMsarthak sehgal
12/05/2023, 6:35 PMarnaud.giuliani
12/06/2023, 8:42 AMsarthak sehgal
12/06/2023, 9:02 AMarnaud.giuliani
12/06/2023, 9:15 AMKoinScope
for that, but opening a KoinScope doesn't link explicitly to the previous parent one. It's opening it, through the declarationarnaud.giuliani
12/06/2023, 9:15 AMsarthak sehgal
12/06/2023, 9:55 AMScope
and Scope::linkTo(vararg scopes: Scope)
API to form this tree-like structure. It works great.
The only difference arises when the dependencies are provided at multiple levels.
for eg.
Scope C -- (linked to) --> Scope B -- (linked to) --> Scope A
where C is the leaf node, B is the parent node and A is the grandparent node.
if a dependency 'Dep'
binding is provided in both scopes 'B' and 'A', and is resolved using scope C like C.get<Dep>()
then, the instance of 'Dep' is resolved from grandparent 'A' instead of the first parent 'B'.
This hinders the ability of lower scopes to override the dependencies that are present at the parent or higher-level Scopes.