flutter_dynamic_forms icon indicating copy to clipboard operation
flutter_dynamic_forms copied to clipboard

How can get a Dart variable of a JSON/XML form element?

Open BrandonRiveraGodines opened this issue 3 years ago • 1 comments

I have a JSON file with the form and have textfields, labels, etc. How can I manipulate through dart code? It's possible make an binding xml~dart?

Regards and excuse, it's really neccesary a documentarion.

BrandonRiveraGodines avatar Jan 04 '21 15:01 BrandonRiveraGodines

When you parse your JSON then the FormManager instance contains the complete tree structure of your form represented as Dart objects. It basically maps all your JSON nodes into the corresponding Dart objects. You can obtain the root of this tree for example by using: FormElement root = FormProvider.of(context).form; So if your root is of type Form and you want to get all children elements, you call (root as Form).children. Normally you don't need to manipulate your tree directly like this, but instead, you can use the element parameter when writing a custom Renderer as described in the Readme.md. Does this answer your question? What is your use case?

OndrejKunc avatar Jan 10 '21 22:01 OndrejKunc