webview_flutter_windows 1.2.0
webview_flutter_windows: ^1.2.0 copied to clipboard
A WebView2-powered webview for Flutter on Windows with seamless composition, keyboard focus integration, and a typed event API.
1.2.0 #
- Fix WebView2 popups opening displaced from the element that raised them
whenever the webview was not at the window's top-left corner:
<select>dropdowns, autofill and passkey bubbles, context menus, permission and print dialogs, and accessibility hit-testing. TheWebviewwidget now reports its position to WebView2 after every frame in which its size, offset or scale factor changed, so scrolling, animations and DPI changes keep popups anchored, and window moves are forwarded so popups that are already open stay put (#7, #8; thanks to @perkinsben-sst). - Add an optional
offsetparameter toWebviewController.setSizefor apps that embed the controller's texture with their own widget: pass the texture's offset from the window's client origin so WebView2 anchors popups correctly. Headless callers can leave it atOffset.zero(#8).
1.1.1 #
- Add AI coding-assistant support for Claude Code and OpenAI Codex: an agent
plugin installable from the repository marketplace, with five
package-specific skills covering integration, the JavaScript bridge and
local content, troubleshooting, channel-mocked testing, and migration from
webview_windows0.x. See the README's "AI coding-assistant support" section (#6). - No changes to the package's Dart or native code.
1.1.0 #
- Add
WebviewController.setDefaultContextMenusEnabled()to enable or disable WebView2's default context menus for subsequent top-level navigations; menus remain disabled by default (#3).
1.0.0 #
First stable release of webview_flutter_windows
(omar-hanafy/webview_flutter_windows),
a maintained fork/rebuild of upstream webview_windows 0.4.0 including all
upstream changes up to ed81bbe. This API is the maintained baseline going
forward: any future breaking change will come with a major version bump.
This release contains breaking changes. See the migration guide for step-by-step upgrade instructions.
Breaking changes #
- Published under the new package name
webview_flutter_windows; migrate dependencies and imports fromwebview_windows. - Requires Dart 3.12+ / Flutter 3.44+.
- All
WebviewControllerevent streams are now broadcast streams: multiple listeners are allowed, and events emitted while nobody listens are dropped. WebErrorStatusvalues are renamed to lowerCamelCase (WebErrorStatusTimeout->WebErrorStatus.timeout); the underlying indexes are unchanged.- Calling controller methods before
initialize()completes now throws aStateErrorwith an actionable message instead of crashing in release builds. initialize()throws aStateErrorwhen called on a disposed controller, and completes with the underlying error on any failure (previously some failures left the controller,ready, anddispose()hanging forever).- The internal
getButtonhelper is no longer exported.
Window focus #
Fixes the long-standing focus loss issue (jnschulze/flutter-webview-windows#230):
- Clicking a webview no longer deactivates the host window (gray title bar, dead keyboard shortcuts).
- Clicking Flutter UI outside a webview hands keyboard focus back to Flutter
automatically, and pressing
Tabpast the page's last focusable element moves focus back to Flutter instead of cycling inside the page forever. - Enforced invariant: while a Flutter text input owns Flutter focus, no
webview keeps native keyboard focus. A
TextFieldgaining focus while the page holds the keyboard - or any code path grabbing native focus while a text input is focused - results in focus being handed back to Flutter immediately, in both event orders. - New API:
WebviewController.focus(),WebviewController.releaseFocus(), theonFocusChangedstream, andhasNativeFocus.
New features #
- Cookie management:
getCookies(),setCookie(), anddeleteCookies()with a typedWebviewCookiemodel (expiry, SameSite, secure, HTTP-only), alongside the existingclearCookies(). - Reference-counted environment lifecycle: the WebView2 environment is
released when the last controller is disposed, so
initializeEnvironment()can be called again - e.g. with a differentuserDataPath- without restarting the app. - Headless usage: a controller can be driven without a
Webviewwidget for background pages; the newsetSize()gives the invisible page real bounds so it performs layout.
Improvements #
initialize()is re-entrant: concurrent calls join the in-flight attempt, and a failed attempt can be retried.dispose()is idempotent, safe in every lifecycle state, and closes all event streams.- Load-error statuses reported by a newer WebView2 runtime than this package
knows map to
WebErrorStatus.unknowninstead of throwing aRangeError. - The
Webviewwidget accepts akeyand resolves its device pixel ratio per view (multi-window safe). - Full dartdoc coverage of the public API.
Native fixes #
- Fixed inverted success reporting for
addVirtualHostNameMapping/removeVirtualHostNameMapping(success was reported as failure). - Fixed
disposesilently leaking the native webview instance for texture ids that fit in 32 bits. - Fixed COM reference leaks and latent use-after-frees in touch pointer events, permission requests, environment creation, WinRT factory access, and native string getters.
- Non-ASCII
additionalArgumentsnow reach Chromium as proper UTF-8 instead of being mangled. - Malformed method channel arguments produce an error result instead of terminating the process, and all nullable native strings are converted null-safely.
- Webview creation failures are surfaced as errors instead of returning a silent, dead instance.
Toolchain #
- WebView2 SDK
1.0.1210.39->1.0.3967.48, WIL1.0.220914.1->1.0.260126.7. - The plugin builds as C++23 and no longer forces a C++ language level onto the consuming app; the CMake minimum is 3.20.
- The NuGet bootstrap is SHA-256 verified and dependencies are installed at
configure time, so first builds no longer race the imported
.targets.
0.3.0 #
0.2.2 #
- Remove
libfmtdependency in favor of C++20std::format - Enable D3D texture bridge by default
- Make
executeScriptreturn the script's result
0.2.1 #
- Add
WebviewController.addScriptToExecuteOnDocumentCreatedandWebviewController.removeScriptToExecuteOnDocumentCreated - Add
WebviewController.onLoadErrorstream - Change
WebviewController.webMessagestream type fromMap<dynamic, dynamic>todynamic - Add virtual hostname mapping support
- Add multi-touch support
0.2.0 #
- Fix Flutter 3.0 null safety warning in example
- Bump WebView2 SDK version to
1.0.1210.3 - Add an option for limiting the FPS
- Change data directory base path from
RoamingAppDatatoLocalAppData
0.1.9 #
- Fix Flutter 3.0 compatibility
0.1.8 #
- Prefix CMake build target names to prevent collisions with other plugins
0.1.7 #
- Add method for opening DevTools
- Update
TextureBridgeGpu - Update
libfmtdependency
0.1.7-dev.2 #
- Ensure Flutter apps referencing
webview_windowsstill work on Windows 8.
0.1.7-dev.1 #
- Remove windowsapp.lib dependency
0.1.6 #
- Improve WebView creation error handling
0.1.5 #
- Fix a potential crash during WebView creation
0.1.4 #
- Improve error handling for Webview environment creation
0.1.3 #
- Stability fixes
0.1.2 #
- Unregister method channel handlers upon WebView destruction
0.1.1 #
- Fix unicode string conversion in ExecuteScript and LoadStringContent
- Load CoreMessaging.dll on demand
0.1.0 #
- Fix a string conversion issue
- Add an option for controlling popup window behavior
- Update Microsoft.Web.WebView2 and Microsoft.Windows.ImplementationLibrary
0.0.9 #
- Fix resizing issues
- Add preliminary GpuSurfaceTexture support
0.0.8 #
- Don't rely on AVX2 support
- Add history controls
- Add suspend/resume support
- Add support for disabling cache, clearing cookies etc.
0.0.7 #
- Add support for handling permission requests
- Allow setting the background color
- Automatically download nuget
0.0.6 #
- Fix mousewheel event handling
- Make text selection work
- Add method for setting the user agent
- Add support for JavaScript injection
- Add support for JSON message passing between Dart and JS
- Fix WebView disposal
0.0.5 #
- Fix input field focus issue
0.0.4 #
- Minor cleanup
0.0.3 #
- Add support for additional cursor types
0.0.2 #
- Add support for loading string content
0.0.1 #
- Initial release