class State<InputState : Any>(val snapshot: InputState)

Allows to create ChangedState objects to change the state as a result of DSL methods like InStateBuilderBlock.on or InStateBuilderBlock.onEnter.

The snapshot property can be used to access the current state at the time the action or event happened. Note that it might be outdated by the time the code runs and should never be used within mutate or to create an object that is passed to override


Link copied to clipboard
constructor(snapshot: InputState)


Link copied to clipboard


Link copied to clipboard

Use this function if you want to "mutate" the current state by copying the old state and modify some properties in the copy of the new state. A common use case is to call .copy() on your state defined as data class.

Link copied to clipboard

No change, this is semantically equivalent to use override or mutate and return this.

Link copied to clipboard
fun <S : Any> override(reducer: InputState.() -> S): ChangedState<S>

Use this function if you want to override the previous state with another state based on the current state.