ToastNotificationRegistry class

Registry for toast notification styles. Stores widget factories keyed by string IDs (e.g., "success", "warning"). Use ToastNotificationRegistry.register to add custom toast styles.

Supports both static ToastStyleFactory styles and data-aware ToastStyleDataFactory styles that receive data at call time.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
styleIds Set<String>
Get all registered toast style IDs.
no setter

Methods

clear() → void
Clear all registered styles (useful for testing).
get(String id) ToastStyleFactory?
Get a toast widget factory by id. Returns the "success" factory with a debug warning if id is not found. Prefer resolve for data-aware factory support.
has(String id) bool
Check if a toast style with id exists.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
register(String id, ToastStyleFactory factory) → void
Register a single toast style with the given id. The factory is wrapped to ignore data (backward compatible).
registerAll(Map<String, dynamic> styles) → void
Register multiple toast styles at once. Accepts both ToastStyleFactory and ToastStyleDataFactory values.
registerWithData(String id, ToastStyleDataFactory factory) → void
Register a data-aware toast style with the given id. The factory receives a Map<String, dynamic> data map at call time.
resolve(String id, Map<String, dynamic> data) ToastStyleFactory?
Resolve a toast style by id, passing data to data-aware factories. Returns the ToastStyleFactory ready to build the widget, or the "success" factory with a debug warning if id is not found.
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

instance ToastNotificationRegistry
final