webview_flutter_wkwebview 3.27.0 copy "webview_flutter_wkwebview: ^3.27.0" to clipboard
webview_flutter_wkwebview: ^3.27.0 copied to clipboard

PlatformiOSmacOS

A Flutter plugin that provides a WebView widget based on Apple's WKWebView control.

webview_flutter_wkwebview #

The Apple WKWebView implementation of webview_flutter.

Usage #

This package is endorsed, which means you can simply use webview_flutter normally. This package will be automatically included in your app when you do, so you do not need to add it to your pubspec.yaml.

However, if you import this package to use any of its APIs directly, you should add it to your pubspec.yaml as usual.

Gesture blocking policy on iOS #

If a web view stops responding to touches after the first interaction on iOS, using hit-test results instead of Flutter's gesture arena to decide when to block the web view's gesture recognizers can work around it:

final params = WebKitWebViewWidgetCreationParams(
  controller: controller,
  uiKitGestureBlockingPolicy: .doNotBlockGesture,
);

Pass those parameters to WebViewWidget.fromPlatformCreationParams, using the platform of your WebViewController as the controller.

This is a workaround for bugs in the underlying WKWebView, and it may cause the web view to recognize a gesture that should have been blocked, so only opt in when a web view is affected. The policy has no effect on macOS.

External Native API #

The plugin also provides a native API accessible by the native code of iOS applications or packages. This API follows the convention of breaking changes of the Dart API, which means that any changes to the class that are not backwards compatible will only be made with a major version change of the plugin. Native code other than this external API does not follow breaking change conventions, so app or plugin clients should not use any other native APIs.

The API can be accessed by importing the native plugin webview_flutter_wkwebview:

Objective-C:

@import webview_flutter_wkwebview;

Then you will have access to the native class FWFWebViewFlutterWKWebViewExternalAPI.

Contributing #

For information on contributing to this plugin, see CONTRIBUTING.md.