Repository navigation
desktop_webview_window-v0.4.0
0.4.0
Browser windows are now fully native, and one browser API works the same way on macOS, Windows and Linux. See Migrating to 0.4.0.
Breaking changes
- Browser windows no longer start a Flutter engine for the title bar. Remove the
runWebViewTitleBarWidgetstartup hook and the title bar widget;TitleBarWebViewController,TitleBarWebViewState,titleBarHeightandtitleBarTopPaddingare removed. Use the default native title bar, configured withTitleBarOptions, or a native composer. (#518) - Replace the platform-specific JavaScript message APIs with one bridge. Pages call
window.desktopWebview.postMessage(name, data)andwindow.desktopWebview.addEventListener(name, listener); Dart usesaddJavaScriptHandler,removeJavaScriptHandlerandpostMessage.registerJavaScriptMessageHandler,unregisterJavaScriptMessageHandler,postWebMessageAsString,postWebMessageAsJsonandaddOnWebMessageReceivedCallbackare removed, and messages posted towindow.webkit.messageHandlers.<name>orchrome.webvieware no longer forwarded. (#518) - JavaScript handlers receive the origin of the sending page:
(Object? data, String origin). Check it before a handler acts for a trusted page; messages from iframes are dropped. (#533) - Remove
moveWebviewWindow,setWebviewWindowVisibility,bringToForegroundandgetPositionalParameters. UsenativeWindowHandlewith a window library. (#518) - Replace
isNavigatingandsetOnHistoryChangedCallbackwithnavigationState. (#518) - Move the Windows options into
WindowsWebviewOptions: useCreateConfiguration(windows: ...)andclearAll(windows: ...)instead ofuserDataFolderWindowsanddenyCameraAndMicrophone. (#518) evaluateJavaScriptreturns the decoded result asFuture<Object?>instead of a JSON string.launch,close,setBrightness,setOnUrlRequestCallback,addScriptToExecuteOnDocumentCreatedandopenDevToolsWindowreturn futures and report native errors. (#518)- Operations a platform does not support throw
UnsupportedErrorinstead of doing nothing, for examplesetBrightnesson Linux andsetPromptHandleroutside macOS. (#518) - Linux: Browser windows are independent top-level windows instead of transient children of the application window. (#518)
- Require Flutter 3.44.0 or later and macOS 10.15 or later. (#518)
Features and fixes
- Add a native title bar with back, forward, reload/stop, page title and host on every platform.
TitleBarOptionschooses its items per window, and a native composer installed by the runner can replace the layout. (#518) - Add
navigationState, aValueListenablewithcanGoBack,canGoForward,isLoading,urlandtitle. (#518) - Add
onLoadError, which reports top-level pages that fail to load with the URL, aWebviewLoadErrorKind(hostLookup,connection,timeout,certificate,other) and the platform's description. (#534) - Add
nativeWindowHandle, the browser'sHWND,NSWindow*orGtkWindow*, for showing, focusing or moving the window with other libraries. (#518) setOnUrlRequestCallbackcan cancel navigations on every platform, and links to schemes the WebView cannot load, such asmailto:, reach it. (#518)- Show native
alertandconfirmdialogs and the system file chooser, ask where to save downloads, and load links that open a new window in the same window, on every platform. (#518) - Add
CreateConfiguration(brightness:), which applies before the window is shown, and supportsetBrightnesson Windows. (#518) - Browser IDs are unique per process. (#518)
- macOS:
getAllCookiesreportsexpires,secure,httpOnlyandsessionOnly. (#518) - Windows: Support ARM64. The WebView2 SDK is downloaded from NuGet at build time and its loader is linked statically, so applications no longer ship
WebView2Loader.dll. The first build afterflutter cleanneeds access toapi.nuget.org. (#532) - macOS: Remove the deprecated Java applet setting and its build warning. (#531)