Package dagger
Annotation Interface Provides
Annotates methods of a module to create a provider method binding. The
method's return type is bound to its returned value. The component
implementation will pass dependencies to the method as parameters.
Nullability
Dagger forbids injecting null
by default. Component implementations that invoke
@Provides
methods that return null
will throw a NullPointerException
immediately thereafter. @Provides
methods may opt into allowing null
by
annotating the method with any @Nullable
annotation like
javax.annotation.Nullable
or androidx.annotation.Nullable
.
If a @Provides
method is marked @Nullable
, Dagger will only allow
injection into sites that are marked @Nullable
as well. A component that attempts to pair
a @Nullable
provision with a non-@Nullable
injection site will fail to compile.