select Async
fun <A, B> StateFlow<A>.selectAsync(scope: CoroutineScope, initialValue: B, workerDispatcher: CoroutineDispatcher = Dispatchers.Default, transform: suspend (A) -> B): StateFlow<B>(source)
Computes an expensive projection on workerDispatcher, retaining its last completed value. Reading the returned StateFlow never invokes transform. New input cancels the old computation. Projection publication and output equality also run on the worker, using the same parent Job. scope controls observation; initialValue is visible until the first computation completes. Unlike select, this projection updates asynchronously. Keep inputs immutable. On JS/Wasm, a dispatcher does not provide a background thread: expensive work must cooperate with the event loop or use an application-provided worker implementation.