GeezerVison is showing api.flutter.dev — ValueListenableBuilder class - widgets library - Dart API
ValueListenableBuilder<T> class
A widget whose content stays synced with a ValueListenable.
Given a ValueListenable<T> and a builder which builds widgets from
concrete values of T, this class will automatically register itself as a
listener of the ValueListenable and call the builder with updated values
when the value changes.
Performance optimizations
If your builder function contains a subtree that does not depend on the
value of the ValueListenable, it's more efficient to build that subtree
once instead of rebuilding it on every animation tick.
If you pass the pre-built subtree as the child parameter, the
ValueListenableBuilder will pass it back to your builder function so
that you can incorporate it into your build.
Using this pre-built child is entirely optional, but can improve
performance significantly in some cases and is therefore a good practice.
link
To create a local project with this code sample, run:
flutter create --sample=widgets.ValueListenableBuilder.1 mysample
See also: