Animation<T> class Null safety

An animation with a value of type T.

An animation consists of a value (of type T) together with a status. The status indicates whether the animation is conceptually running from beginning to end or from the end back to the beginning, although the actual value of the animation might not change monotonically (e.g., if the animation uses a curve that bounces).

Animations also let other objects listen for changes to either their value or their status. These callbacks are called during the "animation" phase of the pipeline, just prior to rebuilding widgets.

To create a new animation that you can run forward and backward, consider using AnimationController.

See also:

  • Tween, which can be used to create Animation subclasses that convert Animation<double>s into other kinds of Animations.
Inheritance
Implemented types
Implementers

Constructors

Animation()
Abstract const constructor. This constructor enables subclasses to provide const constructors so that they can be used in const expressions.
const
Animation.fromValueListenable(ValueListenable<T> listenable, {ValueListenableTransformer<T>? transformer})
Create a new animation from a ValueListenable.
factory

Properties

hashCode int
The hash code for this object.
read-onlyinherited
isCompleted bool
Whether this animation is stopped at the end.
read-only
isDismissed bool
Whether this animation is stopped at the beginning.
read-only
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
status AnimationStatus
The current status of this animation.
read-only
value → T
The current value of the animation.
read-onlyoverride

Methods

addListener(VoidCallback listener) → void
Calls the listener every time the value of the animation changes.
override
addStatusListener(AnimationStatusListener listener) → void
Calls listener every time the status of the animation changes.
drive<U>(Animatable<U> child) Animation<U>
Chains a Tween (or CurveTween) to this Animation.
optionalTypeArgs">@optionalTypeArgs
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
removeListener(VoidCallback listener) → void
Stop calling the listener every time the value of the animation changes.
override
removeStatusListener(AnimationStatusListener listener) → void
Stops calling the listener every time the status of the animation changes.
toString() String
A string representation of this object.
override
toStringDetails() String
Provides a string describing the status of this object, but not including information about the object itself.

Operators

operator ==(Object other) bool
The equality operator.
inherited