dismiss method

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

Dismiss toast overlay.

showAnim Can be used to dismiss a toast with animation effect or not.

Implementation

Future<void> dismiss({
  bool showAnim = false,
}) async {
  if (!_isShow) {
    return;
  }

  _isShow = false;
  _timer?.cancel();
  _onDismiss?.call();
  ToastManager().removeFuture(this);
  if (showAnim) {
    await _containerKey.currentState?.dismissToastAnim();
  } else {
    _containerKey.currentState?.dismissToast();
  }
  _entry.remove();
}