setupValue<T> method

void setupValue<T>({
  1. required String key,
  2. required ValueGetter<T> value,
  3. required bool forward(
    1. T value
    ),
})

Implementation

void setupValue<T>({
  required String key,
  required ValueGetter<T> value,
  required bool Function(T value) forward,
}) {
  var oldValue = value();
  AnimationDirection computeDirection() {
    final newValue = value();
    return oldValue != newValue
        ? forward(oldValue = newValue)
            ? AnimationDirection.forward
            : AnimationDirection.reverse
        : AnimationDirection.unchanged;
  }

  _data[key] = _AnimationData(computeDirection, AnimationDirection.unchanged,
      forward(oldValue) ? _controller.upperBound : _controller.lowerBound);
}