Added Slight Delay to formatJson call to prevent '<optimized out>' error

This commit is contained in:
Manas Hejmadi
2025-04-06 22:44:42 +05:30
parent ea95f7163e
commit a90fff0c08

View File

@ -51,7 +51,10 @@ class _JsonTextFieldEditorState extends State<JsonTextFieldEditor> {
if (widget.initialValue != null) {
controller.text = widget.initialValue!;
}
controller.formatJson(sortJson: false);
Future.delayed(Duration(milliseconds: 50), () {
controller.formatJson(sortJson: false);
setState(() {});
});
editorFocusNode = FocusNode(debugLabel: "Editor Focus Node");
}