1

I get this error when I use a Bottom NavBar using GetX, main screen have a Controller and I add a observable for management the Bottom NavBar state. Each item have a Controller and I add a observable too.

This Obx widget cannot be marked as needing to build because the framework is already in the process of building widgets. A widget can be marked as needing to be built during the build phase only if one of its ancestors is currently building. This exception is allowed because the framework builds parent widgets before children, which means a dirty descendant will always be built. Otherwise, the framework might not visit this widget during this build phase.

rubone
  • 53
  • 6
  • That error means you're calling for a build while you're already in a build method. You should share your code. – Loren.A Sep 28 '21 at 01:38
  • Please provide enough code so others can better understand or reproduce the problem. – Community Oct 05 '21 at 16:40

2 Answers2

0

onReady() can build widget.
yes

  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Sep 10 '22 at 06:30
0

i ran into same error. the answer that solved if for me at https://stackoverflow.com/a/59485997/3120387

wrap the code that listens for updates according to format below:

WidgetsBinding.instance.addPostFrameCallback((_) {   
  // your obx var, eg. global_variables.appBarTitle.value = "Messages";   
});
tmr
  • 1,500
  • 15
  • 22