Resource

sealed class Resource<T>

Sealed class representing a resource with a status. It can be either Success, Error, or Loading.

Parameters

T

The type of the data.

Inheritors

Types

Link copied to clipboard
class Error<T>(message: String, data: T? = null) : Resource<T>

Class representing an erroneous resource.

Link copied to clipboard
class Loading<T> : Resource<T>

Class representing a loading resource.

Link copied to clipboard
class Success<T>(data: T) : Resource<T>

Class representing a successful resource.

Properties

Link copied to clipboard
val data: T? = null

The data of the resource. It can be null.

Link copied to clipboard
val message: String? = null

The message of the resource. It can be null.