Lo que es del dispositivo no lo guarda el servidor. La app declara baldes (demo), el dispositivo guarda los valores, y las pantallas leen con $var: al pintar — sin spinner, sin red.
Leer: un prop que dice $var:demo.note se rellena con lo guardado (vacío si no hay nada):
{
"type": "stack",
"props": {
"background": "surface",
"corner_radius": 12,
"fill_width": true,
"padding": 16
},
"children": [
{
"type": "text",
"props": {
"color": "text_secondary",
"content": "La nota guardada dice:",
"style": "caption"
}
},
{
"type": "text",
"props": {
"content": "$var:demo.note",
"style": "body"
}
}
]
}
sale esto:
La nota guardada dice:
Escribir: value reemplaza, add suma, null borra. Una acción puede escribir varias cosas (writes):
{
"type": "stack",
"props": {
"axis": "horizontal",
"spacing": 8
},
"children": [
{
"type": "button",
"props": {
"action": {
"type": "set_variable",
"path": "note",
"role": "demo",
"value": "hola"
},
"size": "compact",
"style": "prominent",
"title": "Guardar «hola»"
}
},
{
"type": "button",
"props": {
"action": {
"type": "set_variable",
"path": "note",
"role": "demo",
"value": null
},
"size": "compact",
"style": "prominent",
"title": "Borrar"
}
}
]
}
sale esto:
when + $var — un nodo que solo existe si hay algo guardado (así se esconde el carrito vacío):
{
"type": "stack",
"props": {
"background": "surface",
"corner_radius": 10,
"fill_width": true,
"padding": 12
},
"children": [
{
"type": "text",
"props": {
"content": "Esto solo se ve cuando la nota existe.",
"style": "body"
}
}
],
"when": {
"present": "$var:demo.note"
}
}
sale esto: