call method
Widget
call(
- DurableAnimationController controller,
- Widget builder(
- BuildContext context,
- BloomVia via,
- ScopedAnimationController controller
- Key? key,
Creates an inline reactive widget bound to a DurableAnimationController.
Under the Single VSYNC Authority model, the underlying element serves as the physical VSYNC
socket host driving controller, while providing a ScopedAnimationController proxy to builder.
Listeners attached to the scoped proxy's ScopedAnimationController.view are automatically purged
when the host widget unmounts, preventing zombie listener leaks.
controller: The target durable animation controller.builder: Reactive builder callback receiving BuildContext, BloomVia, and ScopedAnimationController.key: Optional widget key.
Requires:
buildermust be a pure, declarative function.
Ensures:
- Returns an animated reactive Widget with automatic ticker management and proxy leak immunity.
Warning (Anti-Pattern Prevention):
- Calling AnimationController.dispose manually inside widget wrappers or store teardown hooks is strictly redundant under Bloom's Inversion of Control dormancy model and can introduce premature invalidation bugs. Let the framework govern ticker allocation.
Examples
final controller = DurableAnimationController(duration: const Duration(milliseconds: 300));
Widget build(BuildContext context) {
return composed.animate(
controller,
(context, via, ctrl) => Opacity(
opacity: ctrl.value,
child: const Text('Fading Content'),
),
);
}
Implementation
@pragma('vm:prefer-inline')
Widget call(
DurableAnimationController controller,
Widget Function(BuildContext context, BloomVia via,
ScopedAnimationController controller)
builder, {
Key? key,
}) =>
_ComposedAnimateWidget(
controller: controller,
builder: builder,
key: key,
);