NotificationExtension extension

Convenience extension on BuildContext for showing toast-style notifications without wiring up a NotificationManager yourself.

These methods let you fire off a notification in a single line from anywhere you have access to a BuildContext:

context.notify('File saved successfully');
context.warn('Disk space is running low');
context.fail('Upload failed — please try again');

Under the hood, each method delegates to NotificationManager.show with the appropriate NotificationType.

on

Methods

fail(String message, {Duration? duration}) → void

Available on BuildContext, provided by the NotificationExtension extension

Shows an error toast notification with the given message.
notify(String message, {Duration? duration}) → void

Available on BuildContext, provided by the NotificationExtension extension

Shows an informational toast notification with the given message.
warn(String message, {Duration? duration}) → void

Available on BuildContext, provided by the NotificationExtension extension

Shows a warning toast notification with the given message.