How to rebuild a specific widget in a list? #3576
-
After I tap one widget, all 10 widgets rebuild. I hope only the widget I tap will rebuild, but I don't know how to do that, any suggestions?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
The rebuild provider watches all the rebuild item providers, so whenever one of these changes, the rebuild provider rebuilds and the whole GridView rebuilds because it watches the rebuild provider. If the number of items is fixed, you don't need to watch them, just create them :
Or just return the number of items, since you do not use the content of You may also just |
Beta Was this translation helpful? Give feedback.
-
Check it: https://itnext.io/flutter-riverpod-simple-example-and-guide-f183de192445 |
Beta Was this translation helpful? Give feedback.
What you probably should do is reverse the dependency: