Skip to content
WebView AllWebView All

Linux

Linux is provided by webview_all_linux 1.3.6 and uses WebKitGTK.

Item Value
Package webview_all_linux
Main platform class LinuxWebViewPlatform
Controller LinuxWebViewController
Widget LinuxWebViewWidget
Navigation delegate LinuxNavigationDelegate
Cookie manager LinuxWebViewCookieManager
Engine WebKitGTK
Required system library webkit2gtk-4.1

The Linux implementation uses a native WebKitGTK widget. The plugin automatically installs the required GtkOverlay before the standard Flutter runner realizes FlView; applications do not need to modify their runner.

final params = const LinuxWebViewControllerCreationParams(
developerExtrasEnabled: true,
javascriptCanOpenWindowsAutomatically: true,
mediaPlaybackRequiresUserGesture: false,
mediaPlaybackAllowsInline: true,
pageCacheEnabled: true,
allowFileAccessFromFileUrls: false,
allowUniversalAccessFromFileUrls: false,
zoomTextOnly: false,
defaultFontSize: 16,
defaultMonospaceFontSize: 13,
minimumFontSize: 0,
zoomFactor: 1.0,
);

Each field is nullable. null leaves the WebKitGTK default unchanged.

API Purpose
setDeveloperExtrasEnabled(bool enabled) Enables WebKitGTK developer extras.
openDevTools() Opens the Web Inspector.
setJavaScriptCanOpenWindowsAutomatically(bool enabled) Controls JavaScript popups.
setMediaPlaybackRequiresUserGesture(bool require) Controls media autoplay policy.
setMediaPlaybackAllowsInline(bool allow) Controls inline media playback.
setPageCacheEnabled(bool enabled) Enables WebKitGTK page cache.
setAllowFileAccessFromFileUrls(bool allow) Allows file pages to read other file URLs.
setAllowUniversalAccessFromFileUrls(bool allow) Allows file pages to access all origins.
setZoomTextOnly(bool enabled) Limits zoom to text.
setDefaultFontSize(int fontSize) Sets proportional font size.
setDefaultMonospaceFontSize(int fontSize) Sets monospace font size.
setMinimumFontSize(int fontSize) Sets minimum font size.
setZoomFactor(double zoomFactor) Sets page zoom.
dispose() Optional Linux-specific early release of the native WebView and event subscription.

Normal cleanup is also automatic: the Linux controller owns a finalizer that releases its native WebView if the controller becomes unreachable. The common WebViewController API does not add dispose(), and removing a widget does not invalidate a controller that may be reused elsewhere.

The common enableZoom(false) API disables plugin-controlled WebKitGTK zoom gestures, including Ctrl+mouse-wheel and Ctrl++/-/0. Ordinary scrolling and keyboard input continue to work.

Linux reports these native events through an event channel:

  • URL changes
  • page start and finish
  • progress
  • history changes
  • title changes
  • web resource errors
  • HTTP response errors
  • JavaScript channel messages
  • console messages
  • scroll position changes
  • navigation requests
  • HTTP auth requests
  • SSL auth errors
  • permission requests for camera and microphone
  • JavaScript alert, confirm, beforeunload, and prompt

Native requests that wait for a Dart decision have a 30-second deadline. Navigation is denied, authentication/dialog/TLS requests are canceled, and permissions are denied if the application never completes a request or the event channel closes. Exceptions from application decision callbacks are logged on one line and use the same safe defaults instead of leaving WebKitGTK blocked.

Type Extra fields
LinuxWebResourceRequest method, headers, isForMainFrame.
LinuxWebResourceResponse mimeType.
LinuxWebResourceError Mapped WebResourceErrorType.
LinuxPlatformSslAuthError description, proceed(), cancel().
LinuxPlatformWebViewPermissionRequest grant() and deny() callbacks.
  • The WebView is a native GTK widget, not a Flutter texture. It follows Flutter’s logical position and size and is clipped at the Flutter viewport, but arbitrary Flutter layer interleaving and clip shapes cannot be reproduced by GtkOverlay.
  • Translation is supported. Scale, rotation, skew, perspective, and mirrored transforms cannot be represented faithfully by a native GTK child; the plugin hides the WebView and logs the limitation instead of leaving a visually misaligned interactive surface.
  • Local files must use absolute paths and are canonicalized before loading. Flutter asset keys containing traversal, absolute paths, or symlink escapes outside the asset bundle are rejected.
  • File URL universal access is powerful and should stay disabled for untrusted local content.
  • Distribution WebKitGTK versions differ; test media, permissions, and dialog flows on your target Linux distribution.
  • Frame updates are asynchronous and failure-isolated; stale widget teardown work cannot surface as an unhandled exception.