DevsOnFlutter / file_manager

FileManager is a wonderful widget that allows you to manage files and folders, pick files and folders, and do a lot more. Designed to feel like part of the Flutter framework.
https://pub.dev/packages/file_manager
BSD 3-Clause "New" or "Revised" License
61 stars 18 forks source link

ValueListenableBuilder<String> widget cannot be marked as needing to build. #23

Closed dasaki-gr closed 1 year ago

dasaki-gr commented 1 year ago

When I try to run the example code given, I get the below error. I'm not familiar with ValueNotifier and ValueListenableBuilder so I can't figure out, what seems to be the issue here.

The following assertion was thrown while dispatching notifications for ValueNotifier: 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.

I have found same issue in :https://stackoverflow.com/questions/71191775/valuelistenablebuilderstring-widget-cannot-be-marked-as-needing-to-build-sets

binhdowkm commented 1 year ago

@dasaki-gr Because FileManagerController was disposed when you navigate to other screen, and this class contains some variables ValueNotifier such as _path, _short,... that widget FileManager need. If you want to quick fix it, you can go to file_manager.dart and comment function dispose() .