derived
Creates a StateFlow that computes its value based on other StateFlows via an autoRun block.
This variant doesn't need a CoroutineScope/CoroutineLauncher.
Parameters
Whether .value
access synchronously recomputes even if someone collects. Defaults to true
.
Caching of StateFlow.value expensive computations while nobody collects. Defaults to true
.
Creates a StateFlow that computes its value based on other StateFlows via an autoRun block.
Parameters
Whether .value
access synchronously recomputes even if someone collects. Defaults to true
.
Caching of StateFlow.value expensive computations while nobody collects. Defaults to true
.
Creates a StateFlow that computes its value based on other StateFlows via an autoRun block.
This behaves like SharingStarted.Eagerly and computes the initial value by executing the observer function immediately.
Creates a StateFlow that computes its value based on other StateFlows via a suspendable coAutoRun block.
You can use this to compute values on-demand only via SharingStarted.WhileSubscribed.
Parameters
The initial value (until the first computation finishes).
When the value should be updated. Pass SharingStarted.WhileSubscribed to compute only on demand. Defaults to SharingStarted.Eagerly.
How changes should be executed/collected. Defaults to conflatedWorker.
The CoroutineDispatcher to use. Defaults to dispatchers.main
.
Tracks loading state for the (re-)computation. Defaults to CoroutineLauncher.loading.
The callback which is used to track the observables.
Creates a StateFlow that computes its value based on other StateFlows via a suspendable coAutoRun block.
You can use this to compute values on-demand only via SharingStarted.WhileSubscribed.
Parameters
The initial value (until the first computation finishes).
When the value should be updated. Pass SharingStarted.WhileSubscribed to compute only on demand. Defaults to SharingStarted.Eagerly.
The CoroutineLauncher to use.
How changes should be executed/collected. Defaults to conflatedWorker.
The CoroutineDispatcher to use. Defaults to dispatchers.main
.
Tracks loading state for the (re-)computation. Defaults to null
.
The callback which is used to track the observables.