collectAsStateWithLifecycle

fun <T> TickingValueProvider<T>.collectAsStateWithLifecycle(clock: ClockWrapper = SYSTEM_CLOCK.collectAsStateWithLifecycle().value, timeZone: TimeZone = SYSTEM_TIMEZONE.collectAsStateWithLifecycle().value, maxTick: Duration? = null): State<T>

Collects values from TickingValueProvider and represents its latest value via State in a lifecycle-aware manner.

Parameters

clock

the Clock to use for localization. By default, it collects SYSTEM_CLOCK, so any clock change is immediately reflected

timeZone

the TimeZone to use for localization. By default, it collects SYSTEM_TIMEZONE, so any timezone change is immediately reflected

maxTick

the maximum amount of to wait for a recomputation (as long as this underlying provider returns a non-null TickingValue.nextTick). If null (the default), no max tick bound is applied.

See also