rodydavis / signals.dart

Reactive programming made simple for Dart and Flutter
http://dartsignals.dev
Apache License 2.0
378 stars 44 forks source link

How does the signal implement the fine-grained update widget function? Why does every update trigger the build of the widget #233

Closed laterdayi closed 2 months ago

laterdayi commented 2 months ago

image As you can see in the figure, I only updated counter, but it triggers the build of all the widgets, which is not very good for performance, just like getbuilder obx can only update the widgets that need to trigger the update

rodydavis commented 2 months ago

That is what the Watch widget is for:

https://dartsignals.dev/flutter/watch/

laterdayi commented 2 months ago

@rodydavis Does this mean that all design-to-signal data parts should use the watch widget for performance reasons

rodydavis commented 2 months ago

If you use the createSignal/createComputed it would be like writing the most performant setState logic.

Breaking things up into smaller widgets and using the watch widget is to isolate renders closer to the UI that is actually changing.