checkedChanges

fun MaterialButton.checkedChanges(): Flow<Boolean>

Create a Flow of material button checked state change events on the MaterialButton instance where the value emitted is whether the button is currently checked.

Note: Created flow keeps a strong reference to the MaterialButton instance until the coroutine that launched the flow collector is cancelled.

Example of usage:

materialButton.checkedChanges()
.onEach { isChecked ->
// handle isChecked
}
.launchIn(uiScope)

Create a InitialValueFlow of checked state changes on the MaterialCardView instance where the value emitted is whether the MaterialCardView is currently checked.

Note: Created flow keeps a strong reference to the MaterialCardView instance until the coroutine that launched the flow collector is cancelled.

Example of usage:

materialCardView.checkedChanges()
.onEach { isChecked ->
// handle isChecked
}
.launchIn(uiScope)