Skip to main content
Different from other Neo widgets: Toast is used as a method call (NeoToast.show()) rather than a widget you place in your build tree. Call it inside callbacks—after button presses, successful API calls, or when operations complete—to provide instant user feedback.

Examples

  • Toast Types
  • With Description
  • Update Toast

Preset toast types with automatic styling and behavior.

NeoToast.show(
  ref: ref,
  label: "Viewing in read-only mode",
  type: NeoToastType.info,
);

Methods

NeoToast.show()

Displays a toast notification at the bottom right of the screen. Returns a string ID that can be used to update the toast later.

Required Parameters

ref
WidgetRef
required
The widget reference from a ConsumerWidget or HookConsumerWidget, used to access the toast provider.
label
String
required
The main text message to display in the toast.
type
NeoToastType
required
The preset type that determines styling, icon, and behavior. Use presets for consistent UX.

Optional Parameters

description
String
Additional text displayed below the main label for extra context.
icon
PhosphorIconData
Custom icon to override the preset icon from type.
color
Color
Custom color to override the preset color from type.
autoDismiss
bool
Custom auto-dismiss behavior to override the preset from type.
isIconRotating
bool
Whether the icon should rotate continuously (e.g. for custom loading states).
showDismissButton
bool
Whether to show a dismiss button. If null, determined by autoDismiss setting.

NeoToast.update()

Updates an existing toast with new content. Perfect for progress feedback or changing toast context.

Required Parameters

ref
WidgetRef
required
The widget reference to access the toast provider.
id
String
required
The ID returned from NeoToast.show() to identify which toast to update.

Optional Parameters

type
NeoToastType
New preset type to apply. Updates styling, icon, and behavior.
label
String
New main text message.
description
String
New description text.
icon
PhosphorIconData
New custom icon.
color
Color
New custom color.
autoDismiss
bool
New auto-dismiss behavior.
isIconRotating
bool
New icon rotation state.
showDismissButton
bool
New dismiss button visibility.

Enums

NeoToastType

Predefined toast configurations that automatically handle styling and behavior.
  • info: General information
  • loading: Ongoing operations with spinner
  • success: Successful actions with checkmark icon
  • warning: Cautionary messages with warning icon
  • danger: Error states with error icon

Best Practices

  • Use Presets: Leverage NeoToastType presets for consistent user experience and automatic behavior
  • Progress Updates: Use NeoToast.update() for operations that transition between states (loading → success/error)
  • Appropriate Duration: Trust preset auto-dismiss behavior—success/info toasts dismiss automatically, errors state require user action, loading state stays until type is changed or programatically dismissed
  • Description Usage: Use description for helpful details like file paths, error codes, or next steps
  • Enhanced Feedback: Combine with NeoHaptics for error toasts to provide tactile feedback alongside visual notifications

Integration Notes

  • Advanced Stacking: Multiple toasts stack vertically with dynamic height calculation and smooth repositioning animations
  • Bounce Animation: Toasts briefly scale up when updated, providing visual feedback for content changes, grabbing user’s attention
I