WebViewEnvironmentSettings class

This class represents all the PlatformWebViewEnvironment settings available.

The browserExecutableFolder, userDataFolder and additionalBrowserArguments may be overridden by values either specified in environment variables or in the registry.

Officially Supported Platforms/Implementations:

  • Windows WebView2
  • Linux WPE WebKit

Constructors

WebViewEnvironmentSettings({String? additionalBrowserArguments, bool? allowSingleSignOnUsingOSPrimaryAccount, bool? areBrowserExtensionsEnabled, bool? automationAllowed, String? browserExecutableFolder, CacheModel? cacheModel, EnvironmentChannelSearchKind? channelSearchKind, List<CustomSchemeRegistration>? customSchemeRegistrations, bool? enableTrackingPrevention, bool? exclusiveUserDataFolderAccess, bool? isCustomCrashReportingEnabled, String? language, List<String>? preferredLanguages, EnvironmentReleaseChannels? releaseChannels, List<String>? sandboxPaths, EnvironmentScrollbarStyle? scrollbarStyle, bool? spellCheckingEnabled, List<String>? spellCheckingLanguages, String? targetCompatibleBrowserVersion, String? timeZoneOverride, String? userDataFolder, String? webProcessExtensionsDirectory})
Officially Supported Platforms/Implementations:

Properties

additionalBrowserArguments String?
If there are multiple switches, there should be a space in between them. The one exception is if multiple features are being enabled/disabled for a single switch, in which case the features should be comma-seperated. Example: "--disable-features=feature1,feature2 --some-other-switch --do-something"
final
allowSingleSignOnUsingOSPrimaryAccount bool?
This property is used to enable single sign on with Azure Active Directory (AAD) and personal Microsoft Account (MSA) resources inside WebView.
final
areBrowserExtensionsEnabled bool?
When this property is set to true new extensions can be added to user profile and used.
final
automationAllowed bool?
Enable or disable automation mode in the WebContext.
final
browserExecutableFolder String?
Use browserExecutableFolder to specify whether WebView2 controls use a fixed or installed version of the WebView2 Runtime that exists on a user machine. To use a fixed version of the WebView2 Runtime, pass the folder path that contains the fixed version of the WebView2 Runtime to browserExecutableFolder. BrowserExecutableFolder supports both relative (to the application's executable) and absolute files paths. To create WebView2 controls that use the installed version of the WebView2 Runtime that exists on user machines, pass a null or empty string to browserExecutableFolder. In this scenario, the API tries to find a compatible version of the WebView2 Runtime that is installed on the user machine (first at the machine level, and then per user) using the selected channel preference. The path of fixed version of the WebView2 Runtime should not contain \Edge\Application\. When such a path is used, the API fails with HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED).
final
cacheModel CacheModel?
Set the cache model for the WebContext.
final
channelSearchKind EnvironmentChannelSearchKind?
This property is EnvironmentChannelSearchKind.MOST_STABLE by default; environment creation searches for a release channel on the machine from most to least stable using the first channel found.
final
customSchemeRegistrations List<CustomSchemeRegistration>?
Set the array of custom scheme registrations to be used.
final
enableTrackingPrevention bool?
This property is used to enable/disable tracking prevention feature in WebView2.
final
exclusiveUserDataFolderAccess bool?
Whether other processes can create WebView2 from WebView2Environment created with the same user data folder and therefore sharing the same WebView browser process instance.
final
hashCode int
The hash code for this object.
no setterinherited
isCustomCrashReportingEnabled bool?
When IsCustomCrashReportingEnabled is set to true, Windows won't send crash data to Microsoft endpoint.
final
language String?
The default display language for WebView.
final
preferredLanguages List<String>?
Set the list of preferred languages for the WebContext.
final
releaseChannels EnvironmentReleaseChannels?
Sets the releaseChannels, which is a mask of one or more EnvironmentReleaseChannels indicating which channels environment creation should search for.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sandboxPaths List<String>?
Set additional paths that should be accessible when running in sandbox mode.
final
scrollbarStyle EnvironmentScrollbarStyle?
The ScrollBar style being set on the WebView2 Environment.
final
spellCheckingEnabled bool?
Enable or disable spell checking in the WebContext.
final
spellCheckingLanguages List<String>?
Set the list of spell checking languages to use.
final
targetCompatibleBrowserVersion String?
Specifies the version of the WebView2 Runtime binaries required to be compatible with your app.
final
timeZoneOverride String?
Set a timezone override for web pages loaded in this WebContext.
final
userDataFolder String?
You may specify the userDataFolder to change the default user data folder location for WebView2. The path is either an absolute file path or a relative file path that is interpreted as relative to the compiled code for the current process. For UWP apps, the default user data folder is the app data folder for the package. For non-UWP apps, the default user data ({Executable File Name}.WebView2) folder is created in the same directory next to the compiled code for the app. WebView2 creation fails if the compiled code is running in a directory in which the process does not have permission to create a new directory. The app is responsible to clean up the associated user data folder when it is done.
final
webProcessExtensionsDirectory String?
Set the directory where web process extension modules are located.
final

Methods

copy() WebViewEnvironmentSettings
Returns a copy of WebViewEnvironmentSettings.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts instance to a map.
toMap({EnumMethod? enumMethod}) Map<String, dynamic>
Converts instance to a map.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

fromMap(Map<String, dynamic>? map, {EnumMethod? enumMethod}) WebViewEnvironmentSettings?
Gets a possible WebViewEnvironmentSettings instance from a Map value.
isPropertySupported(WebViewEnvironmentSettingsProperty property, {TargetPlatform? platform}) bool
Check if the given property is supported by the defaultTargetPlatform or a specific platform.