Animator<T> class

Tween-driving animator with cancel-and-replace semantics.

T must support +, -, and * (scalar multiply by double). A Ticker drives the interpolation off frame-presentation time (same model as CALayer.animate(...) on iOS) between the current value (read via getter) and a target.

A new animate cancels any in-flight tween. Caller awaits the returned future to know when the animation either completed or was superseded.

Mixed-in types
Available extensions

Constructors

Animator({required ValueGetter<T> getter, required ValueSetter<T> setter, Curve? curve})
Animates the value read by getter and written by setter, along curve unless animate names another.

Properties

curve → Curve?
The curve of an animate that names none; linear when absent.
final
disposed → bool
Whether dispose has already run.
no setterinherited
getter → ValueGetter<T>
Reads the animated value.
final
hashCode → int
The hash code for this object.
no setterinherited
isAnimating → bool
Whether a tween is running.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
setter → ValueSetter<T>
Writes the animated value.
final

Methods

addDispose(VoidCallback callback) → void
Registers a disposal callback. Ignored if already disposed.
inherited
animate({required T target, Duration duration = kAnimation, Curve? curve}) → Future<void>
Animate the current value (read via getter) toward target over duration. Returns a future that completes when the animation finishes — or when a subsequent animate supersedes it.
cancel() → void
Stops the tween in flight and completes its future.
dispose() → void
Releases whatever this object holds. Calling it twice is an error.
inherited
disposeBy(Dispose disposer) → void

Available on Disposable, provided by the DisposableDisposerExtension extension

Adds this object's dispose to another Dispose collector.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

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

Static Methods

emitter<T>(ValueEmitter<T> emitter, {Curve? curve}) → Animator<T>
Convenience: wrap a ValueEmitter so its value is the animated state.