Skip to content

Instantly share code, notes, and snippets.

@sudo5in5k
Created June 21, 2020 13:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sudo5in5k/d9fb68f8b666c141e2a98791206a68d5 to your computer and use it in GitHub Desktop.
Save sudo5in5k/d9fb68f8b666c141e2a98791206a68d5 to your computer and use it in GitHub Desktop.
Response Resource in kotlin
sealed class Resource<T>(
val data: T? = null,
val message: String? = null
) {
class Success<T>(data: T) : Resource<T>(data)
class Loading<T>(data: T? = null) : Resource<T>(data)
class Error<T>(message: String, data: T? = null) : Resource<T>(data, message)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment