onPermissionRequest method

  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')])
FutureOr<PermissionResponse?>? onPermissionRequest(
  1. PermissionRequest permissionRequest
)

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 PlatformInAppBrowserEvents.isMethodSupported method to check if this method 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',
    ),
  ],
)
FutureOr<PermissionResponse?>? onPermissionRequest(
  PermissionRequest permissionRequest,
) {
  return null;
}