Open gowda-nirmal opened 1 year ago
Hello Nirmal,
DiagramEditor
is a widget as all other widgets in Flutter. If you call setState
, it calls the build
function and rebuilds the content. So the DiagramEditor is build as fresh widget with no data.
Do not rebuild the widget and the data won't be lost.
You can try passing key
(GlobalKey) to the DiagramEditor to let the engine to know that it's still the same widget and it's not necessary to rebuild it. I haven't tried this in this particular situation but it may fix the issue in your code. Or just do not rebuild it.
Hello @Arokip, I'm facing the same issue, and adding a global key doesn't work for me. I have to open the keyboard in Canvas so it rebuilds the widget.
Hi,
I see this behavior when I use Diagram Editor for one of my projects. When the form re-renders, the data of the diagram is lost. Can someone help me with the same? I have used the pub.dev example and added a simple Floating button that increments the counter.
Regards, Nirmal