Resource

sealed class Resource<T>

A sealed class that represents the result of a resource operation.

Parameters

T

The type of data.

data

The data result of the operation.

error

The error that occurred during the operation, if any.

Inheritors

Types

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

Represents an error state with optional data and an error.

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

Represents a loading state with optional data.

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

Represents a successful result with data.

Properties

Link copied to clipboard
val data: T? = null
Link copied to clipboard
val error: Throwable? = null