You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 16, 2026. It is now read-only.
Describe the bug
When using the for_each function and templates, any action defined in that template (for example, an onPressed handler on a button) is not interacting with global registry so we can't execute actions that interact with registry like 'set_value' or 'navigate_to'.
If the same async action is defined directly on the widget (without using a template / for_each), it works as expected.
To Reproduce
Steps to reproduce the behavior:
Define a template that uses for_each to build a list of buttons, where each button has an async onPressed action. For example:
Describe the bug
When using the
for_eachfunction and templates, any action defined in that template (for example, anonPressedhandler on a button) is not interacting with global registry so we can't execute actions that interact with registry like 'set_value' or 'navigate_to'.If the same async action is defined directly on the widget (without using a template /
for_each), it works as expected.To Reproduce
Steps to reproduce the behavior:
for_eachto build a list of buttons, where each button has an asynconPressedaction. For example:{ "type": "set_value", "args": { "values": { "template": { "type": "elevated_button", "args": { "child": { "type": "text", "args": { "text": "${key}" } }, "onPressed": "${set_value('myvalue','value:'+value['id'])}" } }, "myvalue": "INITIAL", "array": [ {"id": "1"}, {"id": "2"}, {"id": "3"} ] }, "child": { "type": "column", "args": { "children": [ { "type": "text", "listen": [ "myvalue" ], "args": { "text": "${'value: ' + myvalue}" } }, { "type": "column", "args": { "children": "${for_each(array,'template')}" } } ] } } } }Expected behavior
Any sync or async action inside template should work
PR
for_each_pr