composed top-level constant
Top-level architectural functor providing surgical inline reactive widget composition.
Bridges Flutter's element tree with Bloom's 2-Phase LPDAG engine via an internal ComponentElement
mixing in _ReactiveTerminalElementMixin<RawComputedTerminal<Widget>> and _ViaTerminalElementMixin.
Evaluates reactive builder closures with an injected BloomVia tracker, updating only the exact
composed element upon upstream state mutations without rebuilding the surrounding widget tree.
Unified 12-Entrypoint Hierarchy (4 Modes × 3 Child Axes)
composed ((context, via) => ...)
├── .child ((context, via, child) => ..., child: W)
├── .children ((context, via, children) => ..., children: [...])
│
├── .vsync ((context, via, vsync) => ...)
│ ├── .child ((context, via, vsync, child) => ..., child: W)
│ └── .children ((context, via, vsync, children) => ..., children: [...])
│
├── .animate (controller, (context, via, controller) => ...)
│ ├── .child (controller, (context, via, controller, child) => ..., child: W)
│ └── .children (controller, (context, via, controller, children) => ..., children: [...])
│
└── .drive (onTick, (context, via, value) => ...)
├── .child (onTick, (context, via, value, child) => ..., child: W)
└── .children (onTick, (context, via, value, children) => ..., children: [...])
System Architectural Flow
[ Upstream Bloom<T> Mutates ]
│
│ (Phase 1: 0-Compute Push-Dirty Invalidation)
▼
[ RawComputedTerminal<Widget>.onInvalidated: markNeedsBuild() ]
│
│ (Flutter Render Pipeline Scheduling)
▼
[ _ComposedElement.build() -> terminal.data ]
│
├─► If Clean: Returns cached Widget in O(1) (0-Compute)
└─► If Dirty: Evaluates user builder(context, via)
Key Invariants & Architectural Benefits
- Surgical Rebuild Boundary: Rebuilds only the exact composed element without invalidating surrounding parent or sibling widget subtrees.
- 0-Compute Memoization: Inherits RawComputedTerminal cached evaluation, returning the prior widget instance in $O(1)$ when dependencies remain clean.
- 1-Pass Zero-Allocation Epoch Diffing: Discards unused dependency branches dynamically in conditional structures without intermediate heap allocation.
- Subtree Memoization Isolation: Supports
.childand.childrencaching to preserve expensive static subtrees across reactive rebuilds and 60/120fps animation ticks.
See ComposedFunctor.call for primary invocation contracts, parameters, and anti-pattern guidelines. See ComposedFunctor.child and ComposedFunctor.children for static subtree memoization. See ComposedVsyncFunctor for element-level TickerProvider provisioning. See ComposedAnimateFunctor for durable animation controller binding. See ComposedDriveFunctor for continuous frame-ticker drivers.
Examples
final count = blooming(0);
Widget build(BuildContext context) {
return Column(
children: [
const Text('Static Header'),
composed((context, via) => Text('Count: ${via(count.bloom)}')),
],
);
}
Implementation
const composed = ComposedFunctor._();