removeUserScripts method

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

Removes the userScripts from the webpage’s content. User scripts already loaded into the webpage's content cannot be removed. This will have effect only on the next page load.

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> removeUserScripts(
    {required List<UserScript> userScripts}) async {
  assert(_webview?.windowId == null ||
      defaultTargetPlatform != TargetPlatform.iOS);

  for (final userScript in userScripts) {
    await removeUserScript(userScript: userScript);
  }
}