I have a great doubt about the correct use of dagger 2.10 or higher for android implementing according to the specifications of Dagger documentation for Android.
Sample code:
@Singleton
@Component(modules = {
AndroidInjectionModule.class,
ApplicationModulo.class,
ViewBuilderModule.class
})
public interface FipeApplicationComponent extends AndroidInjector<FipeApplication>{
@Component.Builder
interface Builder{
@BindsInstance
FipeApplicationComponent.Builder application(FipeApplication application);
@BindsInstance
FipeApplicationComponent.Builder urlBase(String urlBase);
FipeApplicationComponent build();
}
void inject(FipeApplication app);
}
Previously, when we wanted to bind some instance of a class that needed to be instantiated outside the dagger domains we would pass this instance to the constructor. It is now suggested to use @BindsInstance within a @ Component.Builder interface Builder
I see in some examples on the internet the use of void inject (FipeApplication app) being that according to the previous item that I asked here already has one:
...
@Component.Builder
interface Builder{
@BindsInstance
FipeApplicationComponent.Builder application(FipeApplication application);
...