onNotificationReceived property

  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?> Function(T controller, NotificationReceivedRequest request)? onNotificationReceived
final

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 PlatformWebViewCreationParams.isPropertySupported method to check if this property 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',
    ),
  ],
)
final FutureOr<NotificationReceivedResponse?> Function(
  T controller,
  NotificationReceivedRequest request,
)?
onNotificationReceived;