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

Preset toast types with automatic styling and behavior.

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

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

Optional Parameters

String
Additional text displayed below the main label for extra context.
Object?
Custom icon to override the preset icon from type. Pass a Phosphor icon from phosphoricons_flutter.
Color
Custom color to override the preset color from type.
bool
Custom auto-dismiss behavior to override the preset from type.
bool
Whether the icon should rotate continuously (e.g. for custom loading states).
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

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

Optional Parameters

NeoToastType
New preset type to apply. Updates styling, icon, and behavior.
String
New main text message.
String
New description text.
Object?
New custom icon. Pass a Phosphor icon from phosphoricons_flutter.
Color
New custom color.
bool
New auto-dismiss behavior.
bool
New icon rotation state.
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
  • Presentation Haptics: show and typed update play haptics by default via NeoConfig.enableToastHaptics (light for loading show, heavy for other non-danger types, error for danger). Avoid calling NeoHaptics again for the same presentation unless you intentionally want stacked feedback.

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
  • Swipe-to-Dismiss: When a toast has autoDismiss enabled or a dismiss control visible, users can drag it horizontally to dismiss. Dragging past ~25% of the toast width triggers dismissal. Releasing short of the threshold springs the toast back to its resting position.
Last modified on August 10, 2026