Here you’ll find a definition for SetContext and its attributes details

What is it?

The SetContext action is responsible for changing the value of a context.

The setContext structure is:

contextIdStringContext identifier
valueAnyNew value to apply in the context
pathStringSpecific context point for changing value in case of arrays and maps <key, value>.

How to use it?

See below an example of a text that is set by context and have an initial value “Set Context Example”. The click event have a SetContext action that change the context value to “Context has changed”.

    children = listOf(
        Text(text = "@{myContext}"),
             text = "Change context",
             onPress = listOf(
                       contextId = "myContext",
                       value = "Context has changed"
     context = ContextData(
          id = "myContext",
          value = "Set Context Example"