Skip to content
WebView AllWebView All
Documentation for version 1.2.x; select latest for up-to-date APIs.

iOS and macOS

iOS and macOS are provided by webview_flutter_wkwebview ^3.25.0. webview_all registers it as the default implementation for both Apple platforms.

ItemValue
Packagewebview_flutter_wkwebview
Main platform classWebKitWebViewPlatform
ControllerWebKitWebViewController
WidgetWebKitWebViewWidget
Navigation delegateWebKitNavigationDelegate
Cookie managerWebKitWebViewCookieManager
EngineWKWebView
Minimum iOS13.0+
Minimum macOS10.15+
final params = WebKitWebViewControllerCreationParams(
allowsInlineMediaPlayback: true,
mediaTypesRequiringUserAction: const <PlaybackMediaTypes>{},
limitsNavigationsToAppBoundDomains: false,
javaScriptCanOpenWindowsAutomatically: true,
);
final controller = WebViewController.fromPlatformCreationParams(params);
ParamMeaning
mediaTypesRequiringUserActionSet of PlaybackMediaTypes.audio and PlaybackMediaTypes.video that require user gesture. Empty set allows autoplay.
allowsInlineMediaPlaybackAllows inline HTML5 video playback instead of fullscreen-only playback.
limitsNavigationsToAppBoundDomainsEnables App-Bound Domains on supported iOS versions.
javaScriptCanOpenWindowsAutomaticallyControls JavaScript popup permission. null uses the native default.
APIPurpose
setAllowsBackForwardNavigationGestures(bool enabled)Enables swipe navigation gestures.
setAllowsLinkPreview(bool allow)Enables or disables link previews where supported.
setOnCanGoBackChange(callback)Receives canGoBack state changes.
setInspectable(bool inspectable)Enables WebKit inspection on OS versions that support it.
loadFileWithParams(WebKitLoadFileParams params)Loads a local file with an explicit read access scope.
await (controller.platform as WebKitWebViewController).loadFileWithParams(
WebKitLoadFileParams(
absoluteFilePath: '/Users/me/site/index.html',
readAccessPath: '/Users/me/site',
),
);

readAccessPath must include any local resources referenced by the loaded page.

Use WebKitJavaScriptChannelParams when constructing platform-specific channel params directly:

await controller.platform.addJavaScriptChannel(
WebKitJavaScriptChannelParams(
name: 'Host',
onMessageReceived: (JavaScriptMessage message) {},
),
);

The common WebViewController.addJavaScriptChannel automatically converts common params to WebKit params.

WebKitWebViewPermissionRequest supports:

MethodMeaning
grant()Approves the resource request.
deny()Denies the resource request.
prompt()Lets the system prompt the user where supported.

Your app still needs the corresponding Info.plist privacy description keys.

The same Dart package targets iOS and macOS, but some underlying WebKit wrappers are UIKit-specific. Current macOS limitations include:

AreamacOS limit
Scroll view accessSome scroll view methods are not implemented by the platform wrapper on macOS.
Background color/opacitysetBackgroundColor calls are ignored by the main wrapper on macOS and logged to the terminal.
Link previewAvailability depends on platform support.

For other platform-specific Apple calls, keep platform checks in place and treat UnimplementedError as a signal that the native property has no macOS bridge.

  • WebKit may reject JavaScript return values that cannot be bridged to Dart.
  • App-Bound Domains require host app configuration and supported iOS versions.
  • Permission handling still depends on OS privacy entitlements and user decisions.