ToastifyFlutter class
A utility class to display customizable toast notifications in a Flutter application.
The ToastifyFlutter class provides four types of toast messages:
success, info, warning, and error. These toast messages can be
customized by adjusting the duration, position, style, text alignment, and other
options. This class also handles displaying only one toast at a time.
Example usage:
ToastifyFlutter.success(
context,
message: 'Operation successful!',
duration: 3,
position: ToastPosition.bottom,
style: ToastStyle.simple,
);
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
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
close(
) → void - Closes the currently displayed toast, if any.
-
error(
BuildContext context, {required String message, int duration = 2, ToastPosition position = ToastPosition.bottom, ToastAlignment alignment = ToastAlignment.center, ToastStyle style = ToastStyle.simple, TextStyle? textStyle, TextAlign textAlign = TextAlign.left, bool onClose = false, Curve animationCurve = Curves.easeInOut}) → void - Displays an error toast message.
-
info(
BuildContext context, {required String message, int duration = 2, ToastPosition position = ToastPosition.bottom, ToastAlignment alignment = ToastAlignment.center, ToastStyle style = ToastStyle.simple, TextStyle? textStyle, TextAlign textAlign = TextAlign.left, bool onClose = false, Curve animationCurve = Curves.easeInOut}) → void - Displays a info toast message.
-
success(
BuildContext context, {required String message, int duration = 2, ToastPosition position = ToastPosition.bottom, ToastAlignment alignment = ToastAlignment.center, ToastStyle style = ToastStyle.simple, TextStyle? textStyle, TextAlign textAlign = TextAlign.left, bool onClose = false, Curve animationCurve = Curves.easeInOut}) → void - Displays a success toast message.
-
warning(
BuildContext context, {required String message, int duration = 2, ToastPosition position = ToastPosition.bottom, ToastAlignment alignment = ToastAlignment.center, ToastStyle style = ToastStyle.simple, TextStyle? textStyle, TextAlign textAlign = TextAlign.left, bool onClose = false, Curve animationCurve = Curves.easeInOut}) → void - Displays a warning toast message.