https://kotlinlang.org logo
#dagger
Title
# dagger
g

Geert

11/15/2021, 10:28 AM
Is it possible to provide a variable with hilt like an accesstoken? I receive it after logging in in the app, so basically I would provide an object with hilt and change the properties? But is that working?
u

ursus

11/15/2021, 7:22 PM
well what youre describing is semantic scopes & their arguments in your case it sounds like
LoggedInComponent(accessToken)
j

Jeremy

11/16/2021, 5:18 PM
I'd think the token would be persisted somewhere (encrypted on disk). The lazy provider would fetch would just fetch demand if available. If you want the be notified on all updates could inject an observable
You could also just inject a pojo with mutable state exposed via hilt as
@Singleton
👍 1