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

Windows

Windows is provided by webview_all_windows 1.2.1 and uses Microsoft Edge WebView2.

ItemValue
Packagewebview_all_windows
Main platform classWindowsWebViewPlatform
ControllerWindowsWebViewController
WidgetWindowsWebViewWidget
Navigation delegateWindowsNavigationDelegate
Cookie managerWindowsWebViewCookieManager
EngineWebView2
Minimum OSWindows 10 1809+

Initialize WebView2 before constructing controllers when you need custom paths or arguments:

await WindowsWebViewController.initializeEnvironment(
userDataPath: 'C:\\AppData\\MyApp\\WebView2',
browserExePath: null,
additionalArguments: '--disable-features=msSmartScreenProtection',
);

Check runtime version:

final version = await WindowsWebViewController.getWebViewVersion();
final params = const WindowsWebViewControllerCreationParams(
popupWindowPolicy: WindowsPopupWindowPolicy.sameWindow,
);
final controller = WebViewController.fromPlatformCreationParams(params);

WindowsPopupWindowPolicy:

ValueBehavior
allowAllows popup windows.
denySuppresses popup windows.
sameWindowOpens popup content in the current WebView.
final widget = WebViewWidget.fromPlatformCreationParams(
params: WindowsWebViewWidgetCreationParams(
controller: controller.platform,
scaleFactor: 1.0,
filterQuality: FilterQuality.none,
),
);

scaleFactor controls texture rasterization scale. filterQuality controls Flutter texture filtering.

APIPurpose
openDevTools()Opens WebView2 DevTools.
suspend() / resume()Suspends or resumes the WebView.
setPopupWindowPolicy(policy)Changes popup handling after creation.
setZoomFactor(double zoomFactor)Sets WebView2 zoom factor.
setCacheDisabled(bool disabled)Toggles cache bypass behavior.

Common APIs implemented on Windows include request loading with method, headers, and body; JavaScript execution; JavaScript channels; console messages; JavaScript dialogs; permission requests; HTTP errors; HTTP auth; SSL auth; scroll position; scrollbars; background color; user agent override; and overscroll styling.

Windows exposes extended WebView2 cookie metadata:

final manager = WebViewCookieManager().platform
as WindowsWebViewCookieManager;
await manager.setWindowsCookie(
WindowsWebViewCookie(
name: 'session',
value: 'abc',
domain: 'example.com',
path: '/',
expires: DateTime.now().add(const Duration(days: 1)),
isHttpOnly: true,
isSecure: true,
sameSite: WindowsWebViewCookieSameSite.lax,
),
);

Deletion APIs:

APIPurpose
deleteWindowsCookie(cookie)Deletes by full WebView2 cookie identity.
deleteCookiesWithNameAndUrl(name, url)Deletes cookies matching a name and URL.
deleteCookiesWithNameDomainAndPath(name, domain, path)Deletes cookies by exact identity fields.

Windows-specific response classes add request and response detail:

TypeExtra fields
WindowsWebResourceRequestmethod, headers.
WindowsWebResourceResponsereasonPhrase, mimeType.
WindowsWebResourceErrorWebView2 WebErrorStatus index and mapped WebResourceErrorType.
WindowsPlatformSslAuthErrordescription, proceed(), cancel().
  • Scrollbars and overscroll are implemented with injected CSS because WebView2 does not expose stable direct APIs for every scrollbar behavior.
  • The app must ensure that the WebView2 Runtime is available on target machines.
  • Runtime initialization should happen once and before creating controllers.