addUserScripts method

Future<void> addUserScripts({
  1. required List<UserScript> userScripts,
})

Injects the userScripts into the webpage’s content.

NOTE for iOS: this method will throw an error if the WebView.windowId has been set. There isn't any way to add/remove user scripts specific to iOS window WebViews. This is a limitation of the native iOS WebKit APIs.

Implementation

Future<void> addUserScripts({required List<UserScript> userScripts}) async {
  assert(_webview?.windowId == null ||
      defaultTargetPlatform != TargetPlatform.iOS);

  for (var i = 0; i < userScripts.length; i++) {
    await addUserScript(userScript: userScripts[i]);
  }
}