showToast method

Future<ExtendedOverlayEntry?> showToast(
  1. Toast toast
)

Toast 关闭 closeToast();

Implementation

Future<ExtendedOverlayEntry?> showToast(Toast toast) async {
  if (_toast != null) return _toast;
  _toast = showOverlay(toast, autoOff: true);
  _toast?.addListener(_toastListener);
  final duration =
      toast.options?.duration ?? GlobalOptions().toastOptions.duration;
  await duration.delayed<dynamic>();
  closeToast();
  return _toast;
}