rememberInject

inline fun <T : Any> rememberInject(qualifier: Any? = null): T

Inject an instance with resolved dependencies

@Composable
fun Sample(
controller: SampleController = rememberInject()
) {
/* ... */
}

Parameters

qualifier

Qualifier for identification. Specify the instantiation of the annotation with Qualifier.


inline fun <T : Any> rememberInject(qualifier: Any? = null, componentExtras: ComponentExtras<*>?): T

Inject an instance with resolved dependencies (experimental)

@Composable
fun Sample(
controller: SampleController = rememberInject()
) {
/* ... */
}

Parameters

qualifier

Qualifier for identification. Specify the instantiation of the annotation with Qualifier.

componentExtras

Specify ComponentExtras to create Component.


inline fun <T : Any> rememberInject(name: String): T

Deprecated

The method of specifying qualifier has been unified.

Replace with

import com.moriatsushi.koject.Named
rememberInject(Named(name))

Inject an Named instance with resolved dependencies

Parameters

name

name of Named


inline fun <T : Any> rememberInject(name: String, componentExtras: ComponentExtras<*>? = null): T

Deprecated

The method of specifying qualifier has been unified.

Replace with

import com.moriatsushi.koject.Named
rememberInject(Named(name), componentExtras)

Inject an Named instance with resolved dependencies (experimental)

Parameters

name

name of Named

componentExtras

Specify ComponentExtras to create Component.