UserScript class Null safety

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.
read / write
groupName String?
The script’s group name.
read / write
hashCode int
The hash code for this object.
injectionTime UserScriptInjectionTime
The time at which to inject the script into the WebView.
read / write
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.
read / write
runtimeType Type
A representation of the runtime type of the object.
source String
The script’s source code.
read / write


noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent 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.