setSafeBrowsingAllowlist static method
Sets the list of hosts (domain names/IP addresses) that are exempt from SafeBrowsing checks. The list is global for all the WebViews.
Each rule should take one of these:
| Rule | Example | Matches Subdomain |
|---|---|---|
| HOSTNAME | example.com | Yes |
| .HOSTNAME | .example.com | No |
| IPV4_LITERAL | 192.168.1.1 | No |
| IPV6_LITERAL_WITH_BRACKETS | 10:20:30:40:50:60:70:80 |
No |
All other rules, including wildcards, are invalid. The correct syntax for hosts is defined by RFC 3986.
This method should only be called if WebViewFeature.isFeatureSupported returns true for WebViewFeature.SAFE_BROWSING_ALLOWLIST.
hosts represents the list of hosts. This value must never be null.
Officially Supported Platforms/Implementations:
- Android native WebView (Official API - WebViewCompat.setSafeBrowsingAllowlist)
Implementation
static Future<bool> setSafeBrowsingAllowlist({required List<String> hosts}) =>
PlatformInAppWebViewController.static()
.setSafeBrowsingAllowlist(hosts: hosts);