duration property

Duration get duration

Returns the maximum duration of all properties.

Example: (using supercharged)

final tween = MultiTween<DefaultAnimationProperties>()
  ..add(DefaultAnimationProperties.width, 0.0.tweenTo(100.0), 1.seconds)
  ..add(DefaultAnimationProperties.width, 100.0.tweenTo(200.0), 2.seconds)
  ..add(DefaultAnimationProperties.height, 0.0.tweenTo(200.0), 5.seconds);

tween.duration; // 5.seconds

Implementation

Duration get duration =>
    _tracks.values
        .map((track) => track.duration)
        .sorted((a, b) => a.compareTo(b))
        .lastOrNull ??
    Duration.zero;