toFlow

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

Uses the given clock and timeZone flows to compute the reference point passed to TickingValueProvider.provide and returns the resulting Flow. This function assumes that each Clock emitted by the clock flow moves forward linearly.

Parameters

clock

the Clock to use to obtain the Instant for the reference point. It is a Flow because the time might be changed (e.g. by an NTP sync or by the user manually adjusting the time). Whenever a new ClockWrapper is emitted, the localized string is recomputed. See SYSTEM_CLOCK for more info.

timeZone

the TimeZone to use for the reference point. It is a Flow because it might change (e.g. if the user crosses a time zone line). When a different time zone is emitted, the localized string is recomputed. See SYSTEM_TIMEZONE for more info.

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.