onNotificationReceived method

  1. @SupportedPlatforms.new(platforms: [WindowsPlatform(apiName: 'ICoreWebView2_24.add_NotificationReceived', apiUrl: 'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2_24?view=webview2-1.0.2849.39#add_notificationreceived')])
FutureOr<NotificationReceivedResponse?>? onNotificationReceived(
  1. NotificationReceivedRequest request
)

Event fired when a web notification is received.

The request contains the NotificationReceivedRequest.senderOrigin (the origin of the web content that sends the notification) and the NotificationReceivedRequest.notificationController which provides methods to report the notification status (shown, clicked, closed) back to the web content, as well as listen for the close event when the notification is closed by web code.

Officially Supported Platforms/Implementations:

Parameters - Officially Supported Platforms/Implementations:

  • request: all platforms

Use the PlatformInAppBrowserEvents.isMethodSupported method to check if this method is supported at runtime.

Implementation

@SupportedPlatforms(
  platforms: [
    WindowsPlatform(
      apiName: 'ICoreWebView2_24.add_NotificationReceived',
      apiUrl:
          'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2_24?view=webview2-1.0.2849.39#add_notificationreceived',
    ),
  ],
)
FutureOr<NotificationReceivedResponse?>? onNotificationReceived(
  NotificationReceivedRequest request,
) {
  return null;
}