child method
Creates an inline reactive widget with an isolated static child subtree.
Prevents redundant widget reconstructions by passing child into builder as a pre-constructed,
cached subtree. When reactive dependencies mutate, only the outer container evaluates while child
bypasses re-evaluation.
builder: Reactive builder callback receiving BuildContext, BloomVia, and cachedchild.child: The static subtree to preserve across rebuilds. Must not be null.key: Optional widget key.
Requires:
buildermust be a pure, declarative function.
Ensures:
- Returns a reactive Widget preserving
childacross dependency-driven rebuilds.
Examples
composed.child(
(context, via, child) => Padding(
padding: EdgeInsets.all(via(paddingBloom)),
child: child,
),
child: const ExpensiveGraphicWidget(),
);
Implementation
@pragma('vm:prefer-inline')
Widget child(
Widget Function(BuildContext context, BloomVia via, Widget child) builder, {
required Widget child,
Key? key,
}) =>
_ComposedWithChildWidget(
builder: builder,
key: key,
child: child,
);