Find viewModel.uiState.collectAsState() calls — confirm lifecycle-aware collection

Proprietary

viewModel.uiState.collectAsState() keeps the collector active while the host is in the background — collectAsStateWithLifecycle() is the lifecycle-aware analogue. Both work; the recipe surfaces the call so each ViewModel-collection site is verified rather than defaulted.

org.openrewrite.kotlin.compose.FindStateFlowDirectCollect$KtRecipe
mod run . --recipe='org.openrewrite.kotlin.compose.FindStateFlowDirectCollect$KtRecipe'

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.