有这个 uistate:
sealed interface BusStopsDBScreenUiState {
val message: StringResource?
data class Loading(override val message: StringResource? = null) : BusStopsDBScreenUiState
data class Error(override val message: StringResource? = null) : BusStopsDBScreenUiState
data class Success(val data: List<BusStop>, override val message: StringResource? = null) : BusStopsDBScreenUiState
}
还有这张支票:
if ((currentState is BusStopsDBScreenUiState.Success) || (currentState is BusStopsDBScreenUiState.Error))
_uiState.value = currentState.copy(message = null)
}
我在copy
通话时收到此错误:
未解析的引用:复制
如果我删除||
操作符并让其简单if (currentState is BusStopsDBScreenUiState.Success)
复制就不会再出现该错误。
这怎么可能?如何解决?