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

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.
NeoToastAction
A small secondary button under the text. Auto-dismiss still follows type.
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. You could use it for progress, or when the message changes.

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.
NeoToastAction
A new action button.
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.

Action

NeoToastAction is the button passed to action.

Required

String
required
The text on the button.
VoidCallback
required
Called when the button is pressed. The toast dismisses after that call. A second press does not call it again.

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 a NeoToastType preset unless you need a custom toast.
  • Call NeoToast.update() when one operation moves from loading to success or danger.
  • You could put a file path, an error code, or a next step in description.
  • You could use action for a follow-up, such as undo. Set autoDismiss: false when that follow-up should stay on screen.
  • Do not also call NeoHaptics for the same show or update.

Behavior

  • Toasts stack vertically. Each toast’s height is measured, and the stack moves when one changes.
  • An update scales the toast up briefly.
  • When autoDismiss is on, or a dismiss control is visible, a horizontal drag past about 25% of the width scales the toast down and dismisses it. A shorter drag springs it back.
  • info, success, and warning dismiss on their own. danger stays until the user dismisses it. loading stays until the type changes or you dismiss it.
  • show and a typed update play haptics from NeoConfig.enableToastHaptics: light for a loading show, heavy for other non-danger types, and error for danger.
Last modified on October 11, 2026