When using the SonarLint plugin in Android Studio, it reports unused imports (kotlin:S1128
) for setValue
and getValue
from Jetpack Compose although they are required to use state (e.g. var x by mutableStateOf(true)
).
Version
SonarLint 6.1.0.38326
Minimal Code Sample
Create an Android app in Android Studio with Jetpack Compose (Use Android Studio with Jetpack Compose | Android Developers) and add the following view model:
package com.example.app.viewmodels
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.lifecycle.ViewModel
class TestViewModel: ViewModel() {
var isLoading by mutableStateOf(false)
}