Jamalianpour / easy_sidemenu

An easy to use side menu (navigation rail) in flutter and can used for navigations
https://pub.dev/packages/easy_sidemenu
MIT License
145 stars 70 forks source link

This ValueListenableBuilder<SideMenuDisplayMode> widget cannot be marked as needing to build because #50

Closed aliaktas-tr closed 1 year ago

aliaktas-tr commented 1 year ago

Hi Jamal. In my project I have 2 different page view. User view and pro view. When I switch beetwen of them I got this error and SideMenu does not display.

======== Exception caught by foundation library ==================================================== The following assertion was thrown while dispatching notifications for DisplayModeNotifier: setState() or markNeedsBuild() called during build.

This ValueListenableBuilder 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. The widget on which setState() or markNeedsBuild() was called was: ValueListenableBuilder state: _ValueListenableBuilderState#6926a The widget which was currently being built when the offending call was made was: SideMenu dirty dependencies: [MediaQuery] state: _SideMenuState#27f8c When the exception was thrown, this was the stack: C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddcruntime/errors.dart 266:49 throw

aditya113141 commented 1 year ago

On my side, this error occurs when either of the two widgets are in auto mode. It won't appear if both of the sideMenus have fixed size(either open or compact mode ) and are not bound to change with change in screen size. If one sideMenu is compact and other is open, then also the issue is absent. There must be some issue with update of display mode variables. Any follow up on this ?