Skip to main content

webview_core 1.1.0 copy "webview_core: ^1.1.0" to clipboard
webview_core: ^1.1.0 copied to clipboard

Zero-dependency native WebView plugin for Flutter across Android, iOS, Linux, macOS, Windows, and Web. Replaces webview_flutter and webview_all with Wasm support.

1.1.0 #

Runtime stability release. Fixes native views that stopped responding after being hidden and shown again, restores in-page clicks on freshly mounted previews, adds the missing right-click menu on Windows, and ships a real-native integration test suite.

Fixed #

  • macOS: native WKWebView was permanently destroyed when Flutter hid it. The v1.0.0 teardown that reacted to viewDidMoveToSuperview also fired when the Flutter engine temporarily detached the platform view (IndexedStack, Offstage, collapsing panels, frames without a platform-view layer). The page was stopped, its delegate and script handlers were removed, and every later call (loadHtmlString, evaluateJavaScript, reload, …) silently returned null, leaving an unresponsive view that only recovered after the user chose Reload. The bridge is now owned by the view (view → bridge, bridge ⇢ view weak) and is released only when Flutter releases the view or WebViewController.dispose() is called.
  • macOS: SIGABRT crash (FlutterViewController dispatchMouseEvent:phase:) when scrolling a trackpad while a native context menu is open or crossing the WKWebView / FlutterView boundary mid-gesture. When WKWebView's right-click menu (NSMenuTrackingSession above WebKit's -fno-exceptions C++ stack) or the web view itself consumed NSEvent.Phase.began before subsequent .changed / .ended / .stationary scroll events landed on FlutterView, FlutterViewController.mm threw an unhandled NSInternalInconsistencyException (@"Received gesture event with unexpected phase" — active even in Release builds), causing objc_exception_rethrow to hit std::__terminate(). An NSResponder gesture-phase guard on FlutterViewController now filters unstarted and menu-tracking trackpad phases while keeping normal trackpad, momentum, and discrete wheel scrolling intact without requiring host MainFlutterWindow changes.
  • macOS: evaluateJavaScript('1+1') returned '2.0' instead of '2'; integral JavaScript numbers are now delivered as integers on every platform.
  • Windows: no context menu. Composition hosting never renders the default WebView2 menu. Right-click now shows the Edge menu (Back, Forward, Reload, Copy, …) as a native popup through ContextMenuRequested.
  • Windows: keyboard focus trap. The WebView host consumed every key. Tab, F1–F12, Escape, modifier-only presses, and Win combinations now stay with Flutter so focus traversal and application shortcuts keep working.
  • All desktop and iOS: target="_blank" links and window.open() were silently dropped (macOS, iOS, Linux) or handled by an external popup (Windows). http(s) targets now open in place.
  • Windows: intermittent native crash (0xC0000005 in flutter_windows.dll) on startup and while resizing. The texture callbacks captured a raw this, and shared D3D textures were destroyed on every resize while the Flutter raster thread could still import them by handle. Frame state is now reference counted, replaced textures are kept alive for 3 s, and all textures are handed to the engine's unregister callback on dispose. (Crashed in 2 of 5 integration-test runs before the fix, 0 of 9 after.)
  • Windows: right-click menu froze the view or opened at monitor (0, 0). Showing TrackPopupMenu synchronously inside ContextMenuRequested stalled every later native call (evaluateJavaScript, channels) until the menu closed, while queueing the deferred popup through CreateDispatcherQueueController failed in host applications where another plugin already owned the UI thread's DispatcherQueue, leaving ContextMenuRequested unhandled so WebView2 clamped its fallback popup to (0, 0). The handler now captures the screen cursor position at right-click time, marks the event handled on every exit path, and dispatches the deferred TrackPopupMenu through a Win32 HWND_MESSAGE task runner on the platform thread.
  • Windows: loadHtmlString(baseUrl:) produced an opaque origin. The document ran as about:blank, so document.cookie, localStorage and same-origin requests threw SecurityError. An http(s) baseUrl is now served as that URL, so the page gets the real origin (matching macOS, iOS and Android).
  • Windows: WebViewCookieManager.setCookie before the first view was dropped. Cookies are now queued and applied to the first view that is created.
  • Windows: mouse click inside the WebView froze host UI input. Parenting ICoreWebView2CompositionController directly to FLUTTERVIEW and calling controller_->MoveFocus during onPointerDown let WebView2's internal Chrome_WidgetWin_0 child HWND steal Win32 focus and mouse capture before WM_LBUTTONUP, wedging pointer delivery until put_IsVisible(FALSE) hid the controller. Composition controllers now use an isolated off-client host HWND, FLUTTERVIEW is guarded against WM_KILLFOCUS / WM_CAPTURECHANGED theft from internal WebView2 HWNDs, and PointerCancelEvent releases any active mouse buttons before leave.
  • Linux: mounting a WebView stalled the Flutter 3.50+ engine or crashed on Wayland + NVIDIA. Removing an already-realized FlView (GtkBox) from GtkWindow to wrap it in GtkOverlay triggered fl_view_unrealize, stopping the Dart UI isolate, while WebKitGTK's default DMA-BUF renderer terminated the host process with Wayland protocol error 71 on NVIDIA drivers, and a GDK_WINDOW_CHILD overlay painted behind FlViewRendererSubsurface. GtkOverlay is now packed inside FlView via gtk_widget_reparent without unrealizing FlView, WEBKIT_DISABLE_DMABUF_RENDERER=1 is set by default before WebKitWebContext initialization, and the viewport clip container realizes as a transient GDK_WINDOW_SUBSURFACE on Wayland (GDK_WINDOW_CHILD on X11) so the WebView renders above FlViewRendererSubsurface with working right-click popup menus.
  • Linux: keyboard and mouse input froze after clicking the WebView, dragging splitters, opening popups, or shifting RepaintBoundary ancestors. Clicking WebKitWebView moved GTK focus away from FlView while FlView's GtkEventBox (can_focus = false) never reclaimed it on click and setGeometry(visible: false) left GtkWindow unfocused; ancestor layout shifts and partial popup overlays did not trigger setGeometry when the WebView sat inside a RepaintBoundary; and reload() after loadHtmlString(..., baseUrl:) fetched baseUrl over the network instead of re-rendering the inline HTML. Clicking Flutter's surface or hiding/disposing a focused WebView now immediately restores GTK focus to FlView (F1–F12 and Super shortcuts also pass through), geometry and partial/full popup occlusion sync after every rendered frame without idle polling, active Flutter pointer drags enable temporary overlay pass-through, and reload() (including the native context menu item) preserves inline loadHtmlString documents.

Added #

  • macOS / iOS: automatic recovery from a crashed WebContent process. The failure is reported through NavigationDelegate.onWebResourceError (WebResourceErrorType.webContentProcessTerminated) and the page is reloaded.
  • Native integration tests (example/integration_test/): hide / show cycles, remounts, rounded-clip resize storms, debounced typing storms, JavaScript channels, navigation prevention, cookies, target="_blank", and the example application itself, executed against the real platform plugin (flutter test integration_test -d macos).
  • Windows host key-policy unit test.
  • Redesigned example application with an HTTP response preview, a Mail composer live preview that proves editor text is never modified by preview theming, and a Diagnostics tab (UI heartbeat, native round-trip probe, stress actions, event log).

1.0.0 #

Initial stable release of webview_core — a unified, zero-dependency native WebView plugin for Flutter across Android, iOS, Linux, macOS, Windows, and Web / WebAssembly (dart2wasm).

Zero-Dependency 6-Platform Architecture #

  • Eliminates all external hosted Pub, CocoaPods/SwiftPM, Gradle/Maven, and NuGet CLI dependencies (dependencies: contains only Flutter SDK packages: flutter and flutter_web_plugins), replacing fragmented federated WebView packages with a single self-contained plugin built on package:flutter/widgets.dart.
  • Android (Kotlin / android.webkit.WebView, minSdk 24, compileSdk 36, AGP 8.x & 9.x Built-in Kotlin compatible): Zero-androidx PlatformViewFactory implementation using UTF-8 loadDataWithBaseURL, synchronous-halt + async-decision NavigationDecision.prevent enforcement, custom-header and non-GET loadRequest support, CSS logical-pixel scroll synchronization, CookieManager integration, @JavascriptInterface channels, and zero deprecated APIs.
  • iOS (Swift / WKWebView, iOS 14.0+): Dual Swift Package Manager (Package.swift) and CocoaPods (webview_core.podspec) layout with PrivacyInfo.xcprivacy, WKWebpagePreferences.allowsContentJavaScript, isOpaque = false backdrop synchronization, weak instance registry for automatic UiKitView unmount cleanup, WKHTTPCookieStore support, and zero deprecated APIs.
  • Linux (C++14 / GTK3 & webkit2gtk-4.1): Compiles cleanly under Flutter's standard cxx_std_14 CMake settings and Ubuntu 22.04 (GLib 2.72.4) headers, combining GtkLayout viewport clipping inside GtkOverlay with automatic Visibility / RenderIndexedStack / Offstage / modal-route and hitTestInView occlusion tracking, destroy-signal lifecycle guards, zoom-lock scripts, and WebKitCookieManager support.
  • macOS (Swift / WKWebView, macOS 11.0+): Dual Swift Package Manager (Package.swift) and CocoaPods (webview_core.podspec) layout with PrivacyInfo.xcprivacy, full setBackgroundColor support via direct InteractiveWKWebView AppKitView hit-testing and drawsBackground = false + CALayer / underPageBackgroundColor backdrop, automatic superview detach cleanup, and zero deprecated APIs.
  • Windows (C++17 / WRL & WebView2LoaderStatic.lib x64/ARM64, /W4 /WX & _HAS_EXCEPTIONS=0 clean): Downloads and verifies the official Microsoft.Web.WebView2 archive directly in CMake without nuget.exe or WIL, compositing ICoreWebView2CompositionController frames via zero-copy DXGI shared GPU textures (FlutterDesktopGpuSurfaceDescriptor, with automatic PixelBufferTexture fallback on software adapters), supporting > 2 MB HTML documents via in-memory WebResourceRequested streams, and forwarding HiDPI bounds, keyboard shortcuts, and pointer modifiers.
  • Web & WebAssembly (dart:js_interop / dart:ui_web, dart2wasm clean): Conditional-import architecture isolating dart:io from Web, featuring pure SDK dart:js_interop HTMLIFrameElement rendering (srcdoc, src, sandbox, Standards-Mode <!DOCTYPE> preservation, CSS rgba() background, and contentWindow-verified postMessage channels).

Compatibility Barrels & Core Types #

  • package:webview_core/webview_core.dart: Primary API exporting WebViewController, WebViewWidget, WebView, WebViewCookieManager, WebViewCookie, JavaScriptMode, LoadRequestMethod, NavigationDelegate, NavigationDecision, NavigationRequest, WebResourceError, WebResourceErrorType, UrlChange, and JavaScriptMessage.
  • package:webview_core/webview_flutter.dart: Compatibility barrel for core webview_flutter APIs.
  • package:webview_core/webview_all.dart: Compatibility barrel for webview_all APIs.
1
likes
160
points
162
downloads

Documentation

API reference

Publisher

verified publisherkeyscope.dev

Weekly Downloads

Zero-dependency native WebView plugin for Flutter across Android, iOS, Linux, macOS, Windows, and Web. Replaces webview_flutter and webview_all with Wasm support.

Repository (GitHub)
View/report issues

Topics

#webview #html #browser #wkwebview #webview2

License

Apache-2.0 (license)

Dependencies

flutter, flutter_web_plugins

More

Packages that depend on webview_core

Packages that implement webview_core