Closed BeAddicted closed 7 months ago
Hi, looks I did not thought about such usecase, I will check this.
The reason of current behaviour was type safety guarantees.
For instance such self-targeted transitions should not be possible:
dataState<Int>(...) {
dataTransition<Event, Float>(...) // note different type here
}
// or
state<Int>(...) { // not data state
dataTransition<Event, Int>(...)
}
It is not quite easy to implement, as types are generic and are erased in runtime. I am checking what I can do to make this work.
https://github.com/nsk90/kstatemachine/releases/tag/v0.23.0 Fixed in new release
Seems to work thank you
How can I update the data value of a DataState?
I have a DataState that should transition into itself and should update its data in this case. How can I do this?
I tried to make a dataTransition for the State into itself. But somehow I am not allowed to do that.
java.lang.IllegalArgumentException: data transition should no be self targeted, use simple transition instead
Similar error if I try to make a dataTransition without a targetState.I dont really understand this limitation. Why is this allowed for normal transitions but not for DataTransitions? Is there another way to update the data value of a DataState?