AnimationController constructor Null safety
- {double? value,
- Duration? duration,
- Duration? reverseDuration,
- String? debugLabel,
- double lowerBound = 0.0,
- double upperBound = 1.0,
- AnimationBehavior animationBehavior = AnimationBehavior.normal,
- required TickerProvider vsync}
Creates an animation controller.
-
value
is the initial value of the animation. If defaults to the lower bound. -
duration is the length of time this animation should last.
-
debugLabel is a string to help identify this animation during debugging (used by toString).
-
lowerBound is the smallest value this animation can obtain and the value at which this animation is deemed to be dismissed. It cannot be null.
-
upperBound is the largest value this animation can obtain and the value at which this animation is deemed to be completed. It cannot be null.
-
vsync
is the TickerProvider for the current context. It can be changed by calling resync. It is required and must not be null. See TickerProvider for advice on obtaining a ticker provider.
Implementation
AnimationController({
double? value,
this.duration,
this.reverseDuration,
this.debugLabel,
this.lowerBound = 0.0,
this.upperBound = 1.0,
this.animationBehavior = AnimationBehavior.normal,
required TickerProvider vsync,
}) : assert(lowerBound != null),
assert(upperBound != null),
assert(upperBound >= lowerBound),
assert(vsync != null),
_direction = _AnimationDirection.forward {
_ticker = vsync.createTicker(_tick);
_internalSetValue(value ?? lowerBound);
}