addUserScript method Null safety

Future<void> addUserScript(
  1. {required UserScript userScript}

Injects the specified userScript 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.

Official iOS API:


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

  Map<String, dynamic> args = <String, dynamic>{};
  args.putIfAbsent('userScript', () => userScript.toMap());
  if (!_userScripts.contains(userScript)) {
    await _channel.invokeMethod('addUserScript', args);