select dont rebuild without setState #2031
BigGitWorld
started this conversation in
General
Replies: 1 comment
-
By doing Riverpod works best with immutable state. Try for example using https://pub.dev/packages/freezed to generate your model. void updateProducts(SubModel s){
state = state.copyWith(products: [...state.products, s]);
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello everyone.
I have an object like as the below:
I'm going to watch changes of
products
property ofMainModel class
not whole of the object. So I'm usingselect
.provider:
Watching in the UI layer:
But
MyView
(in UI layer) will not rebuild, althoughdebugPrint
is called wheneverproducts
property is changed.If I use
setState((){})
(in A), my UI will be rebuild.what is the problem?
dependencies:
Beta Was this translation helpful? Give feedback.
All reactions