require State
Assert that the lifecycle in the requiredState. Optionally runs block, for the duration of which the lifecycle is guaranteed to stay in requiredState.
fun requireState(errorMessage: (S) -> String = { "Predicate failed on state $it" }, predicate: (S) -> Boolean)
Assert something about the current state atomically.