showToast static method

void showToast(
  1. BuildContext context,
  2. String text, {
  3. ToastType type = ToastType.success,
  4. ToastDurationType durationType = ToastDurationType.short,
  5. Icon? icon,
})

Static convenience method to display a toast without manually creating a Toast instance.

Example:

Toast.showToast(
  context,
  "Hello World",
  type: ToastType.success,
);

Implementation

static void showToast(
  BuildContext context,
  String text, {
  ToastType type = ToastType.success,
  ToastDurationType durationType = ToastDurationType.short,
  Icon? icon,
}) {
  Toast.create(context).show(
    text,
    type: type,
    durationType: durationType,
    icon: icon,
  );
}