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
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 ifidis not found. Prefer resolve for data-aware factory support. -
has(
String id) → bool -
Check if a toast style with
idexists. -
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, passingdatato data-aware factories. Returns the ToastStyleFactory ready to build the widget, or the "success" factory with a debug warning ifidis 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