Skip to content
This repository was archived by the owner on Feb 16, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
9e5e205
refactor ForEachFunction to use the existing registry instead of crea…
oscar-penelo Nov 15, 2025
7aa7f9b
bump version to 12.0.1 and update changelog for 'for_each' function i…
oscar-penelo Nov 15, 2025
8f99995
New for_each implementation that creates individual key and values in…
oscar-penelo Nov 15, 2025
14f38df
refactor Issue420Page and ForEachFunction to improve template handlin…
oscar-penelo Nov 15, 2025
1c14f15
micro-optimizations made
oscar-penelo Nov 15, 2025
099517c
unique id optimization and dispose callback implemented inside deferr…
oscar-penelo Nov 15, 2025
da6c9bb
remove redundant keyNamePattern regex declaration in ForEachFunction
oscar-penelo Nov 15, 2025
ea70dc3
fix: improve for_each identifier replacement logic
oscar-penelo Nov 16, 2025
29a1b56
fix: issue with deferred_json_widget_data build method registry fixed
oscar-penelo Nov 17, 2025
ab609a4
Added a brace-aware placeholder replacer that walks the template string
oscar-penelo Nov 17, 2025
d18ea05
Merge commit 'e8ea0e4eb7366f154f8f9ba50387a0d81983ea8e' into v12-with…
oscar-penelo Nov 22, 2025
2532374
Merge commit '6e51d2983063f8a8d29e47c084a23e3e7d7d71e7' into v12-with…
oscar-penelo Jan 15, 2026
828611c
docs: remove 12.0.1 entry from CHANGELOG.md.
oscar-penelo Jan 15, 2026
f845a40
docs: Update release date for version 12.0.1 in CHANGELOG.md.
oscar-penelo Jan 15, 2026
e9beaaa
fix: remove merge conflict marker from CHANGELOG.md
oscar-penelo Jan 15, 2026
f45823c
add setvalue that only change when the value changes
oscar-penelo May 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions examples/json_dynamic_widget_example/lib/src/issue_420_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import 'package:json_dynamic_widget/json_dynamic_widget.dart';

/// https://github.com/peiffer-innovations/json_dynamic_widget/issues/420
class Issue420Page extends StatelessWidget {
Issue420Page({super.key});

final JsonWidgetData data = JsonWidgetData.fromDynamic({
"type": "set_value",
"args": {
"cleanup":false,
"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')}"
}
}
]
}
}
}
});

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Issue 420')),
body: Center(child: data.build(context: context)),
);
}
}
7 changes: 7 additions & 0 deletions examples/json_dynamic_widget_example/lib/src/launcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import 'package:json_dynamic_widget_example/src/issue_219_page.dart';
import 'package:json_dynamic_widget_example/src/issue_220_page.dart';
import 'package:json_dynamic_widget_example/src/issue_24_page.dart';
import 'package:json_dynamic_widget_example/src/issue_356_page.dart';
import 'package:json_dynamic_widget_example/src/issue_420_page.dart';

import 'package:json_dynamic_widget_example/src/untestable_full_widget_page.dart';
import 'package:logging/logging.dart';

Expand Down Expand Up @@ -257,6 +259,11 @@ class _RootPageState extends State<RootPage> {
builder: (BuildContext context) => Issue356Page(),
),
),
'issue_420': (context, _) async => Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) => Issue420Page(),
),
),
'layout_builder': _onJsonPageSelected,
'length': _onJsonPageSelected,
'limited_box': _onJsonPageSelected,
Expand Down
8 changes: 6 additions & 2 deletions packages/json_dynamic_widget/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [12.0.1] - January 15th, 2026

* 'for_each' function now uses the existing registry instead of creating new instances. This ensures that variables set during iteration are accessible in the broader context and resolves issues related to variable scope during iteration.


## [12.0.0+5] - January 13, 2026

* Automated dependency updates
Expand All @@ -17,7 +22,7 @@

* Automated dependency updates


## [12.0.0+1] - November 18, 2025

* Automated dependency updates
Expand Down Expand Up @@ -418,7 +423,6 @@ This is a huge release with several breaking changes. It brings in the ability

* Automated dependency updates

>>>>>>> fabcc57c6772a1015dbb260dc2cb5a28bfade292:CHANGELOG.md

## [6.1.0] - July 17th, 2023

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ class _SetValueState extends State<_SetValue> {
@override
void didUpdateWidget(oldWidget) {
super.didUpdateWidget(oldWidget);
oldWidget.values?.forEach(
(key, _) =>
oldWidget.data.jsonWidgetRegistry.removeValue(key, originator: null),
);
oldWidget.values?.forEach((key, _) {
if (widget.values?.containsKey(key) != true) {
oldWidget.data.jsonWidgetRegistry.removeValue(key, originator: null);
}
});

widget.values?.forEach(
(key, value) =>
Expand Down
Loading