Error

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

Represents an error state with optional cached data and error information.

This state indicates that an operation failed. The optional data parameter allows you to keep displaying cached data even when the network request fails, improving user experience in offline scenarios.

Parameters

T

The type of data.

data

Optional cached data to display despite the error.

error

The error that occurred during the operation.

Constructors

Link copied to clipboard
constructor(data: T? = null, error: Throwable)

Properties

Link copied to clipboard
val data: T?

The data result of the operation (can be null for initial loading states).

Link copied to clipboard

The error that occurred during the operation (only set in Error state).