Skip to content
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

Listview.builder does not rebuild Stateful widgets when setState is called #22871

Closed
holyspidoo opened this issue Oct 9, 2018 · 3 comments
Closed

Comments

@holyspidoo
Copy link

When using Listview.builder, if you create items with stateless widgets, they are correctly updated when you call the setState function.

If your Listview.builder items have stateful widgets, they don't refresh when you call setState. They only refresh when you scroll out of view and come back (if the list is long enough).

[✓] Flutter (Channel dev, v0.9.6, on Mac OS X 10.14 18A391, locale en-CA)
    • Flutter version 0.9.6 at 
    • Framework revision 13684e4f8e (7 days ago), 2018-10-02 14:15:17 -0400
    • Engine revision f6af1f20ba
    • Dart version 2.1.0-dev.6.0.flutter-8a919426f0

[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
    • Android SDK at 
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-27, build-tools 27.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.0, Build version 10A255
    • ios-deploy 2.0.0
    • CocoaPods version 1.5.3

[✓] Android Studio (version 3.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 29.0.2
    • Dart plugin version 181.5616
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

@zoechi
Copy link
Contributor

zoechi commented Oct 9, 2018

Can you please provide a minimal running reproduction (main.dart) that allows to reproduce?

@zoechi zoechi added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Oct 9, 2018
@holyspidoo
Copy link
Author

Adding a UniqueKey() to the stateful widget built inside the itemBuilder forces the rebuild of the stateful widget everytime the listview item is rebuilt.

@no-response no-response bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Oct 9, 2018
@github-actions
Copy link

github-actions bot commented Sep 1, 2021

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants