setSafeBrowsingAllowlist method

  1. @override
Future<bool> setSafeBrowsingAllowlist({
  1. required List<String> hosts,
})

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:

Implementation

@override
Future<bool> setSafeBrowsingAllowlist({required List<String> hosts}) async {
  Map<String, dynamic> args = <String, dynamic>{};
  args.putIfAbsent('hosts', () => hosts);
  return await _staticChannel.invokeMethod<bool>(
          'setSafeBrowsingAllowlist', args) ??
      false;
}