// _isRecording is a Boolean
private var _isRecording by mutableStateOf(false)
// _isRecording is a State<Boolean>
private var _isRecording = mutableStateOf(false)
This is why you're getting this error.
You should expose like this:
class SoundViewModel @Inject constructor(): ViewModel() {
private var _isRecording = mutableStateOf(false)
val isRecording: State<Boolean> = _isRecording
}
and consume like this:
@Composable
fun YourComposable(soundViewModel: SoundViewModel) {
val isRecording by soundViewModel.isRecording
* Be the first to Make Comment