Any performance issue for one GlobalKey for each widget?

46 Views Asked by At

For a large widget tree with stateful widgets, there is not a way to navigate widget/state tree from root. The workaround is adding globalKey for each widget, and build a tree of globalKey(s).

   Widget0                   GlobalKey0
      Widget1                   GlobalKey1
        Widget1_1                 GlobalKey1_1
        Widget1_2                 GlobalKey1_2

With globalKey tree, user inputs can be collected from a subtree, and sent to server.

No moving widgets within tree. One to one mapping between widget/state/element. So there will be no re-parenting. right?

Any performance issue with this approach? Thousands of GlobalKey(s) is expected. When a subtree is rebuild, some new GlobalKey(s) will be created and some will be deleted(not referenced, garbage collected?).

0

There are 0 best solutions below