State Event
interface StateEvent
Marker interface for all state events.
State events represent triggers that can cause state transitions in a state machine. Events should be implemented as sealed interfaces or sealed classes to provide type safety and exhaustive when expressions.
Example usage:
sealed interface AuthEvent : StateEvent {
data class Login(val username: String, val password: String) : AuthEvent
data class LoginSuccess(val token: String) : AuthEvent
data object Logout : AuthEvent
}Content copied to clipboard
Events should be:
Immutable data objects
Self-contained with all necessary data
Named with action verbs (Login, Save, Process, etc.)
Specific to their domain or use case