-
-
Notifications
You must be signed in to change notification settings - Fork 640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
setState() or markNeedsBuild() called during build #607
Comments
Can you provide a complete reproducible code example? |
Future.delayed(Duration.zero, () async { This can be solved |
I have the same issue. Did you able to find a solution? |
Can you provide a reproduction case? |
@xuelongqy You can checkout my fork of super_cupertino_navigation_bar library where I implemented pull to refresh to mimic iOS refresher. (In the nested scroll example of the app, you can pull to refresh and check the debug console when you hot reload the app with any change) https://github.com/fikretsengul/super_cupertino_navigation_bar/tree/dev I used the listener pattern of easy_refresh library. But when the widget tree is rebuilt for whatever reason (like changing a text which leads a hot reload), and the _EasyRefreshState is associated to a new widget, didUpdateWidget is called which ends up triggering _ValueListenableBuilderState._valueChanged, scheduling another rebuild, causing this error. Like @Pwuts said, we can ignore this error and the app will work fine, but during debugging this constantly throws exception to the debug console. |
@xuelongqy Sorry to bother you again, but when will there be an update on this? |
Can you give me a reproducible case? |
You can checkout latest test version of my boilerplate on test branch to check this error out: https://github.com/fikretsengul/flutter_advanced_boilerplate/tree/test Commands to run in order to run app: fvm use 3.16.5 Then run the app from app/main.dart. Don't forget to do a hot reload to see the error. |
I don't have a macOS device at the moment and I'm just doing a tentative fix. You can use the latest code from the v3 branch for testing. |
@xuelongqy Thank you, I can confirm that it's working smoothly now. Thank you very much for your fast response, interest and for this wonderful library. |
Fixed in 3.3.5 |
When the widget tree is rebuilt for whatever reason, and the
_EasyRefreshState
is associated to a new widget,didUpdateWidget
is called which ends up triggering_ValueListenableBuilderState._valueChanged
, scheduling another rebuild, causing this error.I'm not sure, but this might be solved by being more selective in calling
notifyListeners()
onindicator_notifier.dart:375
. E.g. call it when the state changes, but not when_headerNotifier._update()
is called to attach a new widget.Possibly related: #579
I can ignore this error and the app will work fine, but during debugging this constantly triggers my debug tools.
The text was updated successfully, but these errors were encountered: