Hello there! Could someone give some hints about u...
# koin
d
Hello there! Could someone give some hints about using custom scopes in Koin? I’m trying to refactor the dependency management in my Android app by creating a
LoggedUserScope
, so that I can provide fresh instances of certain classes at each login. I identified the classes that are used after the login and the ones that are used before the login. 90% of them are used after the login. I have a couple of questions: 1. does this mean that I need to change all the
single
declarations to be
scoped
in the
LoggedUserScope
? 2. how can I verify that the dependencies resolution is working correctly? I’m using the
checkModules
test method but I think I need to provide the
LoggedUserScope
somehow Thanks to everyone that will help!!
🍿 1
a
use you need
scoped
definitions instead of
single
, and put it in a
scope
block
if your app is using the same scope at 90% I would suggest to think about dropping your entire configuration once you loggout, instead of having everything in scope
d
thanks @arnaud.giuliani! how can I drop the configuration at logout?
stopKoin
and then restart?
a
yes, or also
unloadKoinModules
if you have a main module with `included`sub modules
d
yes I do have a main module that groups all the modules for ease of use, also for tests. Thanks I’ll give it a try!
a
ping me if you need 👍