Created
February 8, 2023 15:37
-
-
Save tahaak67/2fb297ed77ee18a791c4f51783b9af51 to your computer and use it in GitHub Desktop.
Resource wraper class with Success, Error and Loading states.
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
/** | |
* Created by Taha Ben Ashur (https://github.com/tahaak67) on 08,Feb,2023 | |
*/ | |
sealed class Resource<T>( | |
val data: T? = null, | |
val message: String? = null | |
) { | |
class Success<T>(data: T) : Resource<T>(data) | |
class Error<T>(message: String, data: T? = null) : Resource<T>(data, message) | |
class Loading<T> : Resource<T>() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment