You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Proposal] Add filter to ValueListenableBuilder for controlling rebuilds #91178
The builder is called every time the valueListenable value changes, therefore if the value is a list and ValueListenableBuilder is used for each single item in ListView, all the items are rebuilt even if only one element of the list changes.
ValueListenableBuilder<List<String>>(
valueListenable: listNotifier,
builder: (context, value, child) {
// Called even when a different element of the list is updated.returnListTile(title:Text(value[index].title, ...);
},
)
Proposal
ValueListenableBuilder will become more convenient with a parameter that is a function to decide if the builder should be called. In the example below, the ListTile is rebuilt only when the relevant element in listNotifier.value is updated, thanks to the filter.
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.
Activity
goderbauer commentedon Feb 23, 2022
As discussed in #91179, this isn't a god idea.
github-actions commentedon Mar 10, 2022
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 -vand a minimal reproduction of the issue.