How can I clear ViewModel at certain event? At the moment when I click 'go back button'. I want to reset the viewModel. But If I check the uiState, when I enter the screen.
1. Prepping -> Idle (which is correct) -> go back
2. (re-enter) Idle -> go back
3. (re-enter) Idle -> go back
I called this function at 'go back event' but it doesn't clear.
// ViewModel
fun clear() = viewModelScope.launch {
onCleared()
}