onNextTransitionEnd method

void onNextTransitionEnd(
  1. dynamic complete()
)

Listens for the next transitionend event and invokes a callback after the event is dispatched.

Implementation

void onNextTransitionEnd(Function() complete) {
  var transitionCount = _isOrWillBeHidden(state.$transitionPhase)
      ? _transitionOutCount(props)
      : _transitionInCount(props);

  _cancelTransitionEventListener();
  _cancelTransitionEndTimer();

  _transitionEndTimer = Timer(props.transitionTimeout!, () {
    assert(ValidationUtil.warn(
        'The number of transitions expected to complete have not completed. Something is most likely wrong.',
    ));

    _cancelTransitionEventListener();

    complete();
  });

  _endTransitionSubscription =
      _transitionNodeRef.current?.onTransitionEnd.skip(transitionCount - 1).take(1).listen((_) {
    _cancelTransitionEndTimer();

    complete();
  });
}