WebViewController.fromPlatform constructor
WebViewController.fromPlatform(
- PlatformWebViewController platform, {
- void onPermissionRequest(
- WebViewPermissionRequest request
Constructs a WebViewController from a specific platform implementation.
onPermissionRequest
: A callback that notifies the host application that
web content is requesting permission to access the specified resources.
To grant access for a device resource, most platforms will need to update
their app configurations for the relevant system resource.
For Android, you will need to update your AndroidManifest.xml
. See
https://developer.android.com/training/permissions/declaring
For iOS, you will need to update your Info.plist
. See
https://developer.apple.com/documentation/uikit/protecting_the_user_s_privacy/requesting_access_to_protected_resources?language=objc.
Implementation
WebViewController.fromPlatform(
this.platform, {
void Function(WebViewPermissionRequest request)? onPermissionRequest,
}) {
if (onPermissionRequest != null) {
platform.setOnPlatformPermissionRequest(
(PlatformWebViewPermissionRequest request) {
onPermissionRequest(WebViewPermissionRequest._(
request,
types: request.types,
));
},
);
}
}