get<T> method Null safety

T get<T>(
  1. P property

Returns the animated value for a specified property regarding the current position (in time) of the animation.

The property needs to align with the enum type you defined when creating the MultiTween.

Example: (using supercharged)

// Tween created somewhere in your code
final tween = MultiTween<DefaultAnimationProperties>()
 ..add(DefaultAnimationProperties.width, 0.0.tweenTo(100.0), 2.seconds);

/* ... */

// Access the values in your animation
var width = values.get(DefaultAnimationProperties.width);

You can also add the value type to increase type soundness by applying a type hint:


If the property doesn't exist it will throw an assertion exception.


T get<T>(P property) {
      "Property '${property.toString()}' does not exists.");

  return _computeValue(property)!;