/** * A wrapper for database and network states. */ sealed class ResultState { /** * A state of [data] which shows that we know there is still an update to come. */ data class Loading(val data: T) : ResultState() /** * A state that shows the [data] is the last known update. */ data class Success(val data: T) : ResultState() /** * A state to show a [throwable] is thrown beside the [lastData] which is cached. */ data class Error(val throwable: Throwable, val lastData: T?) : ResultState() }