Skip to content

Instantly share code, notes, and snippets.

@EmmanuelGuther
Created November 14, 2021 06:53
Show Gist options
  • Save EmmanuelGuther/b5927e5582f2911ebcdf11867b9e8b80 to your computer and use it in GitHub Desktop.
Save EmmanuelGuther/b5927e5582f2911ebcdf11867b9e8b80 to your computer and use it in GitHub Desktop.
sealed class to manage api calls
sealed class ResultData<out T> {
class Loading<out T>: ResultData<T>()
data class Success<out T>(
val data: T
): ResultData<T>()
data class Failure<out T>(
val errorMessage: String?=null, val exception: Exception?= null
): ResultData<T>()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment