ContentBlockerTrigger class

Trigger of the content blocker. The trigger tells to the WebView when to perform the corresponding action. A trigger dictionary must include an ContentBlockerTrigger.urlFilter, which specifies a pattern to match the URL against. The remaining properties are optional and modify the behavior of the trigger. For example, you can limit the trigger to specific domains or have it not apply when a match is found on a specific domain.

Constructors

ContentBlockerTrigger({required String urlFilter, List<String> ifFrameUrl = const <String>[], bool urlFilterIsCaseSensitive = false, List<ContentBlockerTriggerResourceType> resourceType = const <ContentBlockerTriggerResourceType>[], List<String> ifDomain = const <String>[], List<String> unlessDomain = const <String>[], List<ContentBlockerTriggerLoadType> loadType = const <ContentBlockerTriggerLoadType>[], List<String> ifTopUrl = const <String>[], List<String> unlessTopUrl = const <String>[], List<ContentBlockerTriggerLoadContext> loadContext = const <ContentBlockerTriggerLoadContext>[]})

Properties

hashCode int
The hash code for this object.
no setterinherited
ifDomain List<String>
A list of strings matched to a URL's domain; limits action to a list of specific domains. Values must be lowercase ASCII, or punycode for non-ASCII. Add * in front to match domain and subdomains. Can't be used with ContentBlockerTrigger.unlessDomain.
getter/setter pair
ifFrameUrl List<String>
A list of regular expressions to match iframes URL against.
getter/setter pair
ifTopUrl List<String>
A list of strings matched to the entire main document URL; limits the action to a specific list of URL patterns. Values must be lowercase ASCII, or punycode for non-ASCII. Can't be used with ContentBlockerTrigger.unlessTopUrl.
getter/setter pair
loadContext List<ContentBlockerTriggerLoadContext>
An array of strings that specify loading contexts.
getter/setter pair
loadType List<ContentBlockerTriggerLoadType>
A list of ContentBlockerTriggerLoadType that can include one of two mutually exclusive values. If not specified, the rule matches all load types.
getter/setter pair
resourceType List<ContentBlockerTriggerResourceType>
A list of ContentBlockerTriggerResourceType representing the resource types (how the browser intends to use the resource) that the rule should match. If not specified, the rule matches all resource types.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
unlessDomain List<String>
A list of strings matched to a URL's domain; acts on any site except domains in a provided list. Values must be lowercase ASCII, or punycode for non-ASCII. Add * in front to match domain and subdomains. Can't be used with ContentBlockerTrigger.ifDomain.
getter/setter pair
unlessTopUrl List<String>
An array of strings matched to the entire main document URL; acts on any site except URL patterns in provided list. Values must be lowercase ASCII, or punycode for non-ASCII. Can't be used with ContentBlockerTrigger.ifTopUrl.
getter/setter pair
urlFilter String
A regular expression pattern to match the URL against.
getter/setter pair
urlFilterIsCaseSensitive bool
A Boolean value indicating if the URL matching should be case-sensitive. The default value is false.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() Map<String, dynamic>
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) ContentBlockerTrigger