onPermissionRequest property

  1. @SupportedPlatforms.new(platforms: [AndroidPlatform(apiName: 'WebChromeClient.onPermissionRequest', apiUrl: 'https://developer.android.com/reference/android/webkit/WebChromeClient#onPermissionRequest(android.webkit.PermissionRequest)', available: '21'), IOSPlatform(available: '15.0', note: 'The default [PermissionResponse.action] is [PermissionResponseAction.PROMPT].'), MacOSPlatform(available: '12.0', note: 'The default [PermissionResponse.action] is [PermissionResponseAction.PROMPT].'), WindowsPlatform(apiName: 'ICoreWebView2.add_PermissionRequested', apiUrl: 'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2?view=webview2-1.0.2210.55#add_permissionrequested'), LinuxPlatform(apiName: 'WebKitWebView::permission-request', apiUrl: 'https://wpewebkit.org/reference/stable/wpe-webkit-2.0/signal.WebView.permission-request.html')])
FutureOr<PermissionResponse?> Function(T controller, PermissionRequest permissionRequest)? onPermissionRequest
final

Event fired when the WebView is requesting permission to access the specified resources and the permission currently isn't granted or denied.

permissionRequest represents the permission request with an array of resources the web content wants to access and the origin of the web page which is trying to access the restricted resources.

Officially Supported Platforms/Implementations:

Parameters - Officially Supported Platforms/Implementations:

  • permissionRequest: all platforms

Use the PlatformWebViewCreationParams.isPropertySupported method to check if this property is supported at runtime.

Implementation

@SupportedPlatforms(
  platforms: [
    AndroidPlatform(
      apiName: 'WebChromeClient.onPermissionRequest',
      apiUrl:
          'https://developer.android.com/reference/android/webkit/WebChromeClient#onPermissionRequest(android.webkit.PermissionRequest)',
      available: '21',
    ),
    IOSPlatform(
      available: '15.0',
      note:
          'The default [PermissionResponse.action] is [PermissionResponseAction.PROMPT].',
    ),
    MacOSPlatform(
      available: '12.0',
      note:
          'The default [PermissionResponse.action] is [PermissionResponseAction.PROMPT].',
    ),
    WindowsPlatform(
      apiName: 'ICoreWebView2.add_PermissionRequested',
      apiUrl:
          'https://learn.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2?view=webview2-1.0.2210.55#add_permissionrequested',
    ),
    LinuxPlatform(
      apiName: 'WebKitWebView::permission-request',
      apiUrl:
          'https://wpewebkit.org/reference/stable/wpe-webkit-2.0/signal.WebView.permission-request.html',
    ),
  ],
)
final FutureOr<PermissionResponse?> Function(
  T controller,
  PermissionRequest permissionRequest,
)?
onPermissionRequest;