toast method

dynamic toast({
  1. bool clearAllTast = true,
  2. Color? bgColor,
  3. ToastPosition position = ToastPosition.bottom,
})

Implementation

toast({
  bool clearAllTast = true,
  Color ? bgColor,
  ToastPosition position = ToastPosition.bottom,
}) {
  if (clearAllTast) {
    dismissAllToast();
  }

  if (this is Widget) {
    showToastWidget(
      this as Widget,
      position: position,
    );
    return;
  }

  showToast(
    this.toString(),
    position: position,
    backgroundColor: bgColor,
  );
}