Toast class
A utility class responsible for displaying toast messages on top of the UI.
Toasts are rendered using an OverlayEntry and automatically removed after the specified duration. Only one toast can be visible at a time — new toasts will be ignored while another is active.
Use the static method Toast.showToast for convenience.
Constructors
- Toast.create(BuildContext context)
-
Creates a new Toast instance bound to the given
context.factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
show(
String text, {ToastType type = ToastType.success, ToastDurationType durationType = ToastDurationType.short, Icon? icon}) → void -
Displays a toast with the given
text. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
showToast(
BuildContext context, String text, {ToastType type = ToastType.success, ToastDurationType durationType = ToastDurationType.short, Icon? icon}) → void - Static convenience method to display a toast without manually creating a Toast instance.