'lint' task throwing false positive 'ProduceStateDoesNotAssignValue' error for produceState
code snippet for which the false positive is thrown
val data = produceState(emptyList(), state) {
when (state) {
HomeUiState.Out -> someDataFlow
.collectLatest {
value = it
}
HomeUiState.Need -> otherDataFlow
.collectLatest {
value = it
}
}
}
state is of type HomeUiState, which is a sealed class extended by Out & Need only
sealed class HomeUiState {
data object Out : HomeUiState()
data object Need : HomeUiState()
}
No error is shown in the studio but thrown when lint task is run. Able to suppress with annotation @SuppressLint("ProduceStateDoesNotAssignValue")
Description
Jetpack Compose version: 2025.02.00
Jetpack Compose component(s) used: ui, ui-graphics, ui-tooling-preview
Android Studio Build: 2024.2.2 Patch 1
Kotlin version: 2.1.0
'lint' task throwing false positive 'ProduceStateDoesNotAssignValue' error for
produceState
code snippet for which the false positive is thrown
state
is of typeHomeUiState
, which is a sealed class extended byOut
&Need
onlyNo error is shown in the studio but thrown when lint task is run. Able to suppress with annotation
@SuppressLint("ProduceStateDoesNotAssignValue")