Last active
November 2, 2022 13:58
-
-
Save Wajahat-Jawaid/3ee301055f971b1d242e44882386dd73 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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