Thread
#compose
    shikasd

    shikasd

    2 years ago
    Hey, I was experimenting with Transition API and noticed that there's no way to check if user specified a key in transition definition or specify defaults. Do you plan to add support for it later? Example:
    val X = FloatPropKey()
    val Y = FloatPropKey()
    
    val def = transitionDefinition {
        state(Initial) {
            this[X] = 0f
        }
    }
    
    Transition(definition = def, initState = Initial) { state ->
        val xValue = state[X]
        val yValue = state[Y] // <-- Crashes, as no value specified
    }
    Zsolt

    Zsolt

    2 years ago
    I'd be interested in this too. Use-case: transition with default values that offers client-code to customise them. Client code cannot override already set values, as that will trigger IllegalArgumentException saying that the propKey was already set. But if we let the client code define these values in the first place, now we cannot check what keys weren't set so that we can provide defaults.