AwesomeNotificationsWeb class

The web implementation: the browser's page notifications through WebNotificationsEngine, and the add-ons' own (media, calls, live activities) through the builders they register.

A page notification has no action buttons (only a service worker's has) and lives while the page is open: a tap on its body, its closing and the four events work while the app runs in a tab.

Inheritance

Constructors

AwesomeNotificationsWeb()
Constructs a AwesomeNotificationsWeb

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

cancel(int id) → Future<void>
Cancels a single notification and its respective schedule.
override
cancelAll() → Future<void>
Cancels all active notifications and schedules.
override
cancelNotificationsByChannelKey(String channelKey) → Future<void>
Cancels all active notifications and schedules with the specified channelKey.
override
cancelNotificationsByGroupKey(String groupKey) → Future<void>
Cancels all active notifications and schedules with the specified groupKey.
override
checkPermissionList({String? channelKey, List<NotificationPermission> permissions = _allPermissions}) → Future<List<NotificationPermission>>
Checks which notification permissions have been granted to the app.
override
createNotification({required NotificationContent content, List<NotificationActionButton>? actionButtons, List<NotificationExtension>? extensions}) → Future<bool>
LOCAL NOTIFICATION METHODS ********************************************* Creates a new notification with the specified content.
override
createNotificationFromJsonData(Map<String, dynamic> mapData) → Future<bool>
As the method channel does: string entries holding JSON are decoded, extra top-level keys are kept, and any failure answers false.
override
decrementGlobalBadgeCounter() → Future<int>
Decrements the global badge counter by 1.
override
dismiss(int id) → Future<void>
Dismisses a single notification without canceling its respective schedule.
override
dismissAllNotifications() → Future<void>
Dismisses all active notifications without cancelling their respective schedules. Note that dismissing a notification does not remove it from the notification history.
override
dismissNotificationsByChannelKey(String channelKey) → Future<void>
Dismisses all active notifications with the specified channelKey, without cancelling their respective schedules.
override
dismissNotificationsByGroupKey(String groupKey) → Future<void>
Dismisses all active notifications with the specified groupKey, without cancelling their respective schedules.
override
dispose() → Future<void>
DISPOSE METHODS *********************************************
override
getAllActiveNotificationIdsOnStatusBar() → Future<List<int>>
The ids of the app's notifications currently shown in the status bar (see isNotificationActiveOnStatusBar).
override
getAppLifeCycle() → Future<NotificationLifeCycle>
Returns the current state of the app lifecycle in regards to notifications.
override
getDrawableData(String drawablePath) → Future<Uint8List?>
Android resources don't exist on the web.
override
getGlobalBadgeCounter() → Future<int>
Gets the global badge counter, which represents the number of unread notifications that are currently pending for the app.
override
getInitialNotificationAction({bool removeFromActionEvents = false}) → Future<ReceivedAction?>
A page notification can't open a closed page (that needs a service worker): the app never starts from one.
override
getLocalTimeZoneIdentifier() → Future<String>
Returns the identifier for the device's local time zone.
override
getPermissionStatusList({String? channelKey, List<NotificationPermission> permissions = _allPermissions}) → Future<Map<NotificationPermission, NotificationPermissionStatus>>
Returns the explicit status of each requested NotificationPermission.
override
getUtcTimeZoneIdentifier() → Future<String>
Returns the identifier for the UTC time zone.
override
incrementGlobalBadgeCounter() → Future<int>
Increments the badge counter by 1 and returns the new value. If there is no current value for the badge counter, it will be set to 1. This method is the most performant way to increment the badge counter by a single unit.
override
initialize(String? defaultIcon, List<NotificationChannel> channels, {List<NotificationChannelGroup>? channelGroups, bool debug = false}) → Future<bool>
Initializes the plugin by creating a default icon and setting up the initial notification channels. This method only needs to be called once in the main.dart file of your application.
override
isNotificationActiveOnStatusBar({required int id}) → Future<bool>
Checks whether a notification with the specified ID is currently active on the device's status bar.
override
isNotificationAllowed() → Future<bool>
Checks whether notifications are currently allowed globally on the device.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeChannel(String channelKey) → Future<bool>
Removes a notification channel with the specified channelKey.
override
requestPermissionToSendNotifications({String? channelKey, List<NotificationPermission> permissions = _allPermissions}) → Future<bool>
Requests permission from the user to send notifications from the app.
override
resetGlobalBadge() → Future<void>
Resets the global badge counter to zero. This removes any badge icon from the app icon in the launcher. Note that resetting the badge counter does not cancel any scheduled or active notifications.
override
setChannel(NotificationChannel notificationChannel, {bool forceUpdate = false}) → Future<void>
Sets a new notification channel or updates an existing channel.
override
setGlobalBadgeCounter(int? amount) → Future<void>
Sets the global badge counter to the specified value. This value will be displayed on the app's icon badge (if supported by the device). If the amount is 0, the badge counter will be cleared.
override
setListeners({required ActionHandler onActionReceivedMethod, NotificationHandler? onNotificationCreatedMethod, NotificationHandler? onNotificationDisplayedMethod, ActionHandler? onDismissActionReceivedMethod}) → Future<bool>
Defines the global or static methods that will receive notification events. Only after set at least one method, the notification's events will be delivered. These methods require to use the notation @pragma("vm:entry-point")
override
shouldShowRationaleToRequest({String? channelKey, List<NotificationPermission> permissions = _allPermissions}) → Future<List<NotificationPermission>>
A denied permission can't be asked again by the page: the user changes it in the browser's site settings.
override
showAlarmPage() → Future<void>
Opens the system's notifications settings page for the app's alarms.
override
showGlobalDndOverridePage() → Future<void>
Opens the system settings page for overriding device Do Not Disturb mode.
override
showNotificationConfigPage({String? channelKey}) → Future<void>
The browser's site settings can't be opened by a page.
override
toString() → String
A string representation of this object.
inherited

Operators

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

Static Properties

engine ↔ WebNotificationsEngine
The engine over the browser's notifications.
getter/setter pair

Static Methods

dispatchAction(Map<String, dynamic> model, {required String buttonKey, String? input, Map<String, dynamic>? button}) → Future<void>
Emits the action event of model (a model map, as given to a builder), as a pressed button does: onActionReceivedMethod receives it.
registerNotificationBuilder(WebNotificationBuilder builder) → void
Lets an add-on take over createNotification for the models it owns. builder receives the whole model map (content, actionButtons and every extension's entries).
registerRemovalListener(WebRemovalListener listener) → void
Lets an add-on know when the app cancels or dismisses notifications (by id, channel, group or all of them).
registerWith(Registrar registrar) → void