child property

Widget? child
final

The child widget to pass to the builder.

If the builder function contains a subtree that does not depend on the listenable, it is more efficient to build that subtree once instead of rebuilding it on every change of the listenable.

Performance is therefore improved by specifying any widgets that don't need to change using the prebuilt child attribute. The ListenableBuilder passes this child back to the builder callback so that it can be incorporated into the build.

Using this pre-built child is entirely optional, but can improve performance significantly in some cases and is therefore a good practice.

Implementation

final Widget? child;