runOn
This API is intended to simplify and add type-safety to working with sealed class states.
Executes the given block only if the current state is of the given subtype and the given predicate matches.
The block will be cancelled as soon as the state changes to a different type or the predicate does not return true. Note that this does not guarantee the operation in the block is atomic.
The state is captured and does not change within this block.
Parameters
the class of the state to match. Must be a subclass of the Container's state type.
optional predicate to match the state against. Defaults to true.
This API is intended to simplify and add type-safety to working with sealed class states. This can be applied to any Flow of states, not just the Container's own. The main purpose of this API is to help you work with child container states.
Executes the given block only if the current state is of the given subtype and the given predicate matches.
The block will be cancelled as soon as the state changes to a different type or the predicate does not return true. Note that this does not guarantee the operation in the block is atomic.
The state is captured and does not change within this block.
Parameters
the class of the state to match. Must be a subclass of the Container's state type.
optional predicate to match the state against. Defaults to true.