ToastificationType class

Defines the visual and behavioral characteristics of built-in toast notifications. This class is used by the BuiltInBuilder to style and render different types of notifications with consistent appearance.

Each type comes with predefined:

  • A unique name identifier
  • A theme color that affects the toast's appearance
  • An icon that represents the notification type

The package provides four built-in types:

  • info - For general information messages (blue)
  • success - For successful operations (green)
  • warning - For warning messages (yellow/orange)
  • error - For error messages (red)

Usage example with Toastification.show:

toastification.show(
  type: ToastificationType.success,
  title: Text('Operation Successful'),
  description: Text('Your changes have been saved'),
);

You can also create custom types:

final customType = ToastificationType.custom(
  'custom',
  Colors.purple,
  Icons.star,
);

Constructors

ToastificationType.custom(String name, Color color, IconData icon)
Creates a custom toast type with specified name, color and icon.
const
factory

Properties

color Color
The color associated with this toast type
final
hashCode int
The hash code for this object.
no setteroverride
icon IconData
The icon to be displayed with this toast type
final
name String
The unique identifier name for this toast type
final
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.
override

Operators

operator ==(Object other) bool
The equality operator.
override

Static Properties

defaultValues List<ToastificationType>
Returns a list of all predefined toast types
no setter

Constants

error → const ToastificationType
Predefined error toast type with red color scheme and close icon
info → const ToastificationType
Predefined information toast type with blue color scheme and info icon
success → const ToastificationType
Predefined success toast type with green color scheme and checkmark icon
warning → const ToastificationType
Predefined warning toast type with yellow/orange color scheme and warning icon