I am trying to add LoadStateListener. But I am getting the error "Classifier 'Error' does not have a companion object, and thus must be initialized here" for LoadState.Error . Below is the code snippet.
adapter.addLoadStateListener { loadStates ->
when {
loadStates.refresh ==LoadState.Error ->{ ----->Gives error here
}
loadStates.refresh == LoadState.Loading -> {
binding.loadingAnimationProgressbar.visibility = View.VISIBLE
}
loadStates.append == LoadState.Loading -> {
binding.loadingAnimationProgressbar.visibility = View.VISIBLE
}
else -> {
binding.loadingAnimationProgressbar.visibility = View.GONE
}
}
Can someone tell what is the issue here ?