Create a module to provide runtime value using singleton object as storage.
// a module to provide value via singleton object@Moduleinternal class RuntimeModule { @Provides fun provideUsername() = RuntimeInjection.username}
// singleton object as storageobject RuntimeInjection { var username: String = ""}
// Assign value to singleton object during runtimeRuntimeInjection.username = "Desmond"
NOTE: Make sure to include Module via @Module(includes = [RuntimeModule::class]) in AppModule
or @Component(modules = [..., [RuntimeModule::class]) in AppComponent
.
NOTE: If you are providing multiple values of the same type object (e.g. username and password, which are both string), use Qualifiers.
NOTE: I am not sure if this is a good practice/pattern.
NOTE: If the parameter/object is available during application startup, you can use Binding Instances.