JavaScriptController class
Domain-specific facade of InAppWebViewController for JavaScript evaluation, JavaScript handlers and user script management.
Part of the domain controller split (issue #161, P3). Every method delegates straight to the underlying platform controller (InAppWebViewController.platform); the monolith routes grouped calls back through this facade (see FR-002).
Constructors
- JavaScriptController(InAppWebViewController _controller)
-
Creates a JavaScriptController bound to the given controller.
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addJavaScriptHandler(
{required String handlerName, required JavaScriptHandlerCallback callback}) → void -
Registers a JavaScript handler with the given
handlerName. -
addUserScript(
{required UserScript userScript}) → Future< void> -
Adds the given
userScript. -
addUserScripts(
{required List< UserScript> userScripts}) → Future<void> -
Adds the given
userScripts. -
callAsyncJavaScript(
{required String functionBody, Map< String, dynamic> arguments = const <String, dynamic>{}, ContentWorld? contentWorld}) → Future<CallAsyncJavaScriptResult?> -
Calls the given async JavaScript
functionBody. -
evaluateJavascript(
{required String source, ContentWorld? contentWorld}) → Future -
Evaluates the given JavaScript
source. -
hasJavaScriptHandler(
{required String handlerName}) → bool -
Whether a JavaScript handler with the given
handlerNameexists. -
hasUserScript(
{required UserScript userScript}) → bool -
Whether the given
userScriptis currently injected. -
injectJavascriptFileFromAsset(
{required String assetFilePath}) → Future - Injects a JavaScript file from the app assets into the page.
-
injectJavascriptFileFromUrl(
{required WebUri urlFile, ScriptHtmlTagAttributes? scriptHtmlTagAttributes}) → Future< void> -
Injects a JavaScript file from the given
urlFileinto the page. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeAllUserScripts(
) → Future< void> - Removes all user scripts.
-
removeJavaScriptHandler(
{required String handlerName}) → JavaScriptHandlerCallback? -
Removes the JavaScript handler with the given
handlerName. -
removeUserScript(
{required UserScript userScript}) → Future< bool> -
Removes the given
userScript. -
removeUserScripts(
{required List< UserScript> userScripts}) → Future<void> -
Removes the given
userScripts. -
removeUserScriptsByGroupName(
{required String groupName}) → Future< void> -
Removes all user scripts of the given
groupName. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited