Created
April 21, 2020 10:10
-
-
Save PatilShreyas/e058a01b400e38fd874eb1dbb61d2c6f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
sealed class State<T> { | |
class Loading<T> : State<T>() | |
data class Success<T>(val data: T) : State<T>() | |
data class Failed<T>(val message: String) : State<T>() | |
companion object { | |
fun <T> loading() = Loading<T>() | |
fun <T> success(data: T) = Success(data) | |
fun <T> failed(message: String) = Failed<T>(message) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment