Resource

sealed class Resource<T>

A sealed class representing different states of a resource.

Parameters

T

The type of data contained in the resource.

Inheritors

Types

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

Represents the error state of a resource.

Link copied to clipboard
class Loading<T>(data: T? = null) : Resource<T>

Represents the loading state of a resource.

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

Represents the success state of a resource.

Properties

Link copied to clipboard
val data: T? = null

The actual data.

Link copied to clipboard
val message: String? = null

A message associated with the resource, usually describing an error.