OptimisticObject

Data class representing an optimistic state with methods to apply optimistic updates.

This class is designed to be used with destructuring declarations for clean access to its properties:

val (optimisticState, addOptimistic) = rememberOptimistic(initialState)

Parameters

T

The type of the state.

D

The type of the optimistic value.

Properties

Link copied to clipboard
val addOptimistic: CoroutineScope.(D) -> OptimisticCompletionHandle

A function to add a new optimistic update within a CoroutineScope. Returns a completion handle that can be used to manually signal completion.

Link copied to clipboard

The current state including any applied optimistic updates.