ContentBlocker class

Class that represents a set of rules to use block content in the browser window.

On iOS, it uses WKContentRuleListStore. On Android, it uses a custom implementation because such functionality doesn't exist.

In general, this article can be used to get an overview about this functionality but on Android there are two types of action that are unavailable: block-cookies and ignore-previous-rules.


ContentBlocker({required ContentBlockerTrigger trigger, required ContentBlockerAction action})


action ContentBlockerAction
Action associated to the trigger. The action tells to the WebView what to do when the trigger is matched.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
trigger ContentBlockerTrigger
Trigger of the content blocker. The trigger tells to the WebView when to perform the corresponding action.
getter/setter pair


noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
toMap() Map<String, Map<String, dynamic>>
toString() String
A string representation of this object.


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

Static Methods

fromMap(Map<dynamic, Map> map) ContentBlocker