addScriptToExecuteOnDocumentCreated method

Future<ScriptID?> addScriptToExecuteOnDocumentCreated(
  1. String script
)

Adds the provided JavaScript script to a list of scripts that should be run after the global object has been created, but before the HTML document has been parsed and before any other script included by the HTML document is run.

Returns a ScriptID on success which can be used for removeScriptToExecuteOnDocumentCreated.

see https://docs.microsoft.com/en-us/microsoft-edge/webview2/reference/win32/icorewebview2?view=webview2-1.0.1264.42#addscripttoexecuteondocumentcreated

Implementation

Future<ScriptID?> addScriptToExecuteOnDocumentCreated(String script) async {
  if (_isDisposed) {
    return null;
  }
  assert(value.isInitialized);
  return _methodChannel.invokeMethod<String?>(
      'addScriptToExecuteOnDocumentCreated', script);
}