drive<U> method

Animation<U> drive<U>(
  1. Animatable<U> child
)

Chains this animation with an Animatable to produce a derived Animation of a different type.

This is typically called on an Animation<double> (like an AnimationController) to transform the double into another type via a Tween or CurveTween.

final curved = controller.drive(CurveTween(curve: Curves.easeIn));
final color = controller.drive(ColorTween(begin: red, end: blue));

Implementation

Animation<U> drive<U>(Animatable<U> child) {
  assert(
    this is Animation<double>,
    'drive() can only be called on Animation<double>',
  );
  return child.animate(this as Animation<double>);
}