UserScript class

Class that represents a script that the WebView injects into the web page.


UserScript({String? groupName, required String source, required UserScriptInjectionTime injectionTime, bool iosForMainFrameOnly = true, ContentWorld? contentWorld})


contentWorld ContentWorld
A scope of execution in which to evaluate the script to prevent conflicts between different scripts. For more information about content worlds, see ContentWorld.
getter/setter pair
groupName String?
The script’s group name.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
injectionTime UserScriptInjectionTime
The time at which to inject the script into the WebView.
getter/setter pair
iosForMainFrameOnly bool
A Boolean value that indicates whether to inject the script into the main frame. Specify true to inject the script only into the main frame, or false to inject it into all frames. The default value is true.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
source String
The script’s source code.
getter/setter pair


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


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