call method

Widget call(
  1. DurableAnimationController controller,
  2. Widget builder(
    1. BuildContext context,
    2. BloomVia via,
    3. ScopedAnimationController controller
    ), {
  3. 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.

Requires:

  • builder must 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,
    );