Replies: 1 comment 3 replies
-
Not necessarily.
Usually you shouldn't be selecting "the entire model". Pick only what you need in that model. Maybe in your specific scenario you need to, but that's not supposed to be common. And you can make an extension method to help if you want: extension<T> on FutureProvider<T> {
ProviderListenable<T> get myFuture => selectAsync((a) => a);
} |
Beta Was this translation helpful? Give feedback.
-
In many places in my app, I have a future provider that depends on another future provider. For example:
With region model defined as:
Every time
someParamProvider
reloads, the region provider also runs again, even if the value of someParam didn't change after the reload. When you watch the future, shouldn't it only trigger an update when the actual value changes?As a workaround to this issue, you can select the value like so:
This will only rebuild region when the actual value of
someParam
changes. I think this is what developers want in most cases. So shouldn't it be the default behavior of watching the future? It's quite tedious to callselectAsync
everywhere when you are selecting the entire model. If this cannot be made to the default behavior, could a shortcut be added like thissomeParamProvider.selectValue
? This would be equivalent tosomeParamProvider.selectAsync((value) => value)
.Beta Was this translation helpful? Give feedback.
All reactions