dismiss method

void dismiss({
  1. bool showAnim = false,
})

Implementation

void dismiss({bool showAnim = false}) {
  if (!_isShow) {
    ToastManager().removeFuture(this);
    timer?.cancel();
    _dismissed = true;
    _removeEntry();
    return;
  }

  _isShow = false;
  _onDismiss?.call();
  ToastManager().removeFuture(this);

  if (showAnim) {
    _containerKey.currentState?.showDismissAnim();
    Future<void>.delayed(animationDuration, _removeEntry);
  } else {
    _removeEntry();
  }

  timer?.cancel();
  _dismissed = true;
}