tween property

Tween<T> tween

Defines the target value for the animation.

When the widget first builds, the animation runs from Tween.begin to Tween.end, if Tween.begin is non-null. A new animation can be triggered at anytime by providing a new Tween with a new Tween.end value. The new animation runs from the current animation value (which may be Tween.end of the old tween, if that animation completed) to Tween.end of the new tween. The Tween.begin value is ignored except for the initial animation that is triggered when the widget builds for the first time.

Any (subclass of) Tween is accepted as an argument. For example, to animate the height or width of a Widget, use a Tween<double>, or check out the ColorTween to animate the color property of a Widget.

Any Tween provided must have a non-null Tween.end value.


The TweenAnimationBuilder takes full ownership of the provided Tween and it will mutate the Tween. Once a Tween instance has been passed to TweenAnimationBuilder its properties should not be accessed or changed anymore to avoid any interference with the TweenAnimationBuilder. If you need to change the Tween, create a new instance with the new values.

It is good practice to never store a Tween provided to a TweenAnimationBuilder in an instance variable to avoid accidental modifications of the Tween.


final Tween<T> tween;