I’m new to Dagger 2. I have this scenario, I wan't to inject an object across my app (in presenters, in api)
I do not have a way to provide it initially. It is not created till after authentication at some stage in my app.
From the documentation http://google.github.io/dagger/
I see Lazy loading might be a way to solve this e.g
@Inject
Lazy<Grinder> lazyGrinder;
and then get the value like this using: lazyGrinder.get().grind();
My questions are:
- Can I safely swap the object after this with a new one?
- Are there any other recommended ways to do this?
Thanks