Skip to content

Instantly share code, notes, and snippets.

@Wajahat-Jawaid
Last active November 2, 2022 13:58
Show Gist options
  • Save Wajahat-Jawaid/3ee301055f971b1d242e44882386dd73 to your computer and use it in GitHub Desktop.
Save Wajahat-Jawaid/3ee301055f971b1d242e44882386dd73 to your computer and use it in GitHub Desktop.
/**
* A generic class that holds a value or an exception.
*/
sealed class Result<out R> {
data class Success<out T>(val data: T) : Result<T>()
data class Loading<out T>(val data: T?) : Result<Nothing>()
data class Error(val exception: Exception) : Result<Nothing>()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment