Package dagger
Annotation Type Provides
-
@Documented @Target(METHOD) @Retention(RUNTIME) public @interface ProvidesAnnotates 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
nullby default. Component implementations that invoke@Providesmethods that returnnullwill throw aNullPointerExceptionimmediately thereafter.@Providesmethods may opt into allowingnullby annotating the method with any@Nullableannotation likejavax.annotation.Nullableorandroidx.annotation.Nullable.If a
@Providesmethod is marked@Nullable, Dagger will only allow injection into sites that are marked@Nullableas well. A component that attempts to pair a@Nullableprovision with a non-@Nullableinjection site will fail to compile.