children method

Widget children(
  1. Widget builder(
    1. BuildContext context,
    2. BloomVia via,
    3. List<Widget> children
    ), {
  2. required List<Widget> children,
  3. Key? key,
})

Creates an inline reactive widget with isolated static children subtrees.

Prevents redundant widget reconstructions in multi-child layouts (Row, Column, Stack) where layout properties are reactive but children remain static.

  • builder: Reactive builder callback receiving BuildContext, BloomVia, and cached children.
  • children: The static subtrees to preserve across rebuilds. Must not be null.
  • key: Optional widget key.

Requires:

  • builder must be a pure, declarative function.

Ensures:

  • Returns a reactive Widget preserving children across dependency-driven rebuilds.

Examples

composed.children(
  (context, via, children) => Row(
    mainAxisAlignment: via(alignmentBloom),
    children: children,
  ),
  children: const [SidebarWidget(), MainContentWidget()],
);

Implementation

@pragma('vm:prefer-inline')
Widget children(
  Widget Function(BuildContext context, BloomVia via, List<Widget> children)
      builder, {
  required List<Widget> children,
  Key? key,
}) =>
    _ComposedWithChildrenWidget(
      builder: builder,
      key: key,
      children: children,
    );