[webview_flutter_wkwebview] Change callbacks setters to anonymous functions (#5921)

diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart
index 5dfb78c..0a1dd34 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart
+++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart
@@ -244,6 +244,7 @@
   /// This should only be used by subclasses created by this library or to
   /// create copies.
   NSObject({
+    this.observeValue,
     BinaryMessenger? binaryMessenger,
     InstanceManager? instanceManager,
   }) : _api = NSObjectHostApiImpl(
@@ -262,6 +263,13 @@
 
   final NSObjectHostApiImpl _api;
 
+  /// Informs the observing object when the value at the specified key path has changed.
+  final void Function(
+    String keyPath,
+    NSObject object,
+    Map<NSKeyValueChangeKey, Object?> change,
+  )? observeValue;
+
   /// Registers the observer object to receive KVO notifications.
   Future<void> addObserver(
     NSObject observer, {
@@ -287,21 +295,10 @@
     instance._api.instanceManager.removeWeakReference(instance);
   }
 
-  /// Informs the observing object when the value at the specified key path has changed.
-  Future<void> setObserveValue(
-    void Function(
-      String keyPath,
-      NSObject object,
-      Map<NSKeyValueChangeKey, Object?> change,
-    )?
-        observeValue,
-  ) {
-    throw UnimplementedError();
-  }
-
   @override
   Copyable copy() {
     return NSObject(
+      observeValue: observeValue,
       binaryMessenger: _api.binaryMessenger,
       instanceManager: _api.instanceManager,
     );
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart
index 1d89b18..2ed1602 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart
+++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/ui_kit/ui_kit.dart
@@ -64,8 +64,11 @@
 /// Wraps [UIView](https://developer.apple.com/documentation/uikit/uiview?language=objc).
 class UIView extends NSObject {
   /// Constructs an [NSObject].
-  UIView({BinaryMessenger? binaryMessenger, InstanceManager? instanceManager})
-      : _viewApi = UIViewHostApiImpl(
+  UIView({
+    super.observeValue,
+    BinaryMessenger? binaryMessenger,
+    InstanceManager? instanceManager,
+  }) : _viewApi = UIViewHostApiImpl(
           binaryMessenger: binaryMessenger,
           instanceManager: instanceManager,
         );
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.dart
index 2b887e9..f2efd66 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.dart
+++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit/web_kit.dart
@@ -350,6 +350,8 @@
 class WKScriptMessageHandler extends NSObject {
   /// Constructs a [WKScriptMessageHandler].
   WKScriptMessageHandler({
+    required this.didReceiveScriptMessage,
+    super.observeValue,
     BinaryMessenger? binaryMessenger,
     InstanceManager? instanceManager,
   }) : _scriptMessageHandlerApi = WKScriptMessageHandlerHostApiImpl(
@@ -366,15 +368,10 @@
   /// Use this method to respond to a message sent from the webpage’s
   /// JavaScript code. Use the [message] parameter to get the message contents and
   /// to determine the originating web view.
-  Future<void> setDidReceiveScriptMessage(
-    void Function(
-      WKUserContentController userContentController,
-      WKScriptMessage message,
-    )?
-        didReceiveScriptMessage,
-  ) {
-    throw UnimplementedError();
-  }
+  final void Function(
+    WKUserContentController userContentController,
+    WKScriptMessage message,
+  ) didReceiveScriptMessage;
 }
 
 /// Manages interactions between JavaScript code and your web view.
@@ -572,6 +569,8 @@
 class WKUIDelegate extends NSObject {
   /// Constructs a [WKUIDelegate].
   WKUIDelegate({
+    this.onCreateWebView,
+    super.observeValue,
     BinaryMessenger? binaryMessenger,
     InstanceManager? instanceManager,
   }) : _uiDelegateApi = WKUIDelegateHostApiImpl(
@@ -584,15 +583,10 @@
   final WKUIDelegateHostApiImpl _uiDelegateApi;
 
   /// Indicates a new [WKWebView] was requested to be created with [configuration].
-  Future<void> setOnCreateWebView(
-    void Function(
-      WKWebViewConfiguration configuration,
-      WKNavigationAction navigationAction,
-    )?
-        onCreateWebView,
-  ) {
-    throw UnimplementedError();
-  }
+  final void Function(
+    WKWebViewConfiguration configuration,
+    WKNavigationAction navigationAction,
+  )? onCreateWebView;
 }
 
 /// Methods for handling navigation changes and tracking navigation requests.
@@ -606,6 +600,12 @@
   /// Constructs a [WKNavigationDelegate].
   WKNavigationDelegate({
     this.didFinishNavigation,
+    this.didStartProvisionalNavigation,
+    this.decidePolicyForNavigationAction,
+    this.didFailNavigation,
+    this.didFailProvisionalNavigation,
+    this.webViewWebContentProcessDidTerminate,
+    super.observeValue,
     super.binaryMessenger,
     super.instanceManager,
   }) : _navigationDelegateApi = WKNavigationDelegateHostApiImpl(
@@ -623,6 +623,12 @@
   /// library or to create a copy for an InstanceManager.
   WKNavigationDelegate.detached({
     this.didFinishNavigation,
+    this.didStartProvisionalNavigation,
+    this.decidePolicyForNavigationAction,
+    this.didFailNavigation,
+    this.didFailProvisionalNavigation,
+    this.webViewWebContentProcessDidTerminate,
+    super.observeValue,
     super.binaryMessenger,
     super.instanceManager,
   }) : _navigationDelegateApi = WKNavigationDelegateHostApiImpl(
@@ -636,49 +642,36 @@
   final void Function(WKWebView webView, String? url)? didFinishNavigation;
 
   /// Called when navigation from the main frame has started.
-  Future<void> setDidStartProvisionalNavigation(
-    void Function(WKWebView webView, String? url)?
-        didStartProvisionalNavigation,
-  ) {
-    throw UnimplementedError();
-  }
+  final void Function(WKWebView webView, String? url)?
+      didStartProvisionalNavigation;
 
   /// Called when permission is needed to navigate to new content.
-  Future<void> setDecidePolicyForNavigationAction(
-      Future<WKNavigationActionPolicy> Function(
+  final Future<WKNavigationActionPolicy> Function(
     WKWebView webView,
     WKNavigationAction navigationAction,
-  )?
-          decidePolicyForNavigationAction) {
-    throw UnimplementedError();
-  }
+  )? decidePolicyForNavigationAction;
 
   /// Called when an error occurred during navigation.
-  Future<void> setDidFailNavigation(
-    void Function(WKWebView webView, NSError error)? didFailNavigation,
-  ) {
-    throw UnimplementedError();
-  }
+  final void Function(WKWebView webView, NSError error)? didFailNavigation;
 
   /// Called when an error occurred during the early navigation process.
-  Future<void> setDidFailProvisionalNavigation(
-    void Function(WKWebView webView, NSError error)?
-        didFailProvisionalNavigation,
-  ) {
-    throw UnimplementedError();
-  }
+  final void Function(WKWebView webView, NSError error)?
+      didFailProvisionalNavigation;
 
   /// Called when the web view’s content process was terminated.
-  Future<void> setWebViewWebContentProcessDidTerminate(
-    void Function(WKWebView webView)? webViewWebContentProcessDidTerminate,
-  ) {
-    throw UnimplementedError();
-  }
+  final void Function(WKWebView webView)? webViewWebContentProcessDidTerminate;
 
   @override
   Copyable copy() {
     return WKNavigationDelegate.detached(
       didFinishNavigation: didFinishNavigation,
+      didStartProvisionalNavigation: didStartProvisionalNavigation,
+      decidePolicyForNavigationAction: decidePolicyForNavigationAction,
+      didFailNavigation: didFailNavigation,
+      didFailProvisionalNavigation: didFailProvisionalNavigation,
+      webViewWebContentProcessDidTerminate:
+          webViewWebContentProcessDidTerminate,
+      observeValue: observeValue,
       binaryMessenger: _navigationDelegateApi.binaryMessenger,
       instanceManager: _navigationDelegateApi.instanceManager,
     );
@@ -715,6 +708,7 @@
   /// configuration object.
   WKWebView(
     WKWebViewConfiguration configuration, {
+    super.observeValue,
     super.binaryMessenger,
     super.instanceManager,
   })  : _binaryMessenger = binaryMessenger,
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit_webview_widget.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit_webview_widget.dart
index 90f1554..1cfbc6e 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit_webview_widget.dart
+++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/web_kit_webview_widget.dart
@@ -92,6 +92,7 @@
   }
 
   bool _zoomEnabled = true;
+  bool _hasNavigationDelegate = false;
 
   final Map<String, WKScriptMessageHandler> _scriptMessageHandlers =
       <String, WKScriptMessageHandler>{};
@@ -112,7 +113,15 @@
 
   /// Used to integrate custom user interface elements into web view interactions.
   @visibleForTesting
-  late final WKUIDelegate uiDelegate = webViewProxy.createUIDelgate();
+  late final WKUIDelegate uiDelegate =
+      webViewProxy.createUIDelgate(onCreateWebView: (
+    WKWebViewConfiguration configuration,
+    WKNavigationAction navigationAction,
+  ) {
+    if (!navigationAction.targetFrame.isMainFrame) {
+      webView.loadRequest(navigationAction.request);
+    }
+  });
 
   /// Methods for handling navigation changes and tracking navigation requests.
   @visibleForTesting
@@ -121,25 +130,42 @@
     didFinishNavigation: (WKWebView webView, String? url) {
       callbacksHandler.onPageFinished(url ?? '');
     },
-  )
-        ..setDidStartProvisionalNavigation((WKWebView webView, String? url) {
-          callbacksHandler.onPageStarted(url ?? '');
-        })
-        ..setDidFailNavigation((WKWebView webView, NSError error) {
-          callbacksHandler.onWebResourceError(_toWebResourceError(error));
-        })
-        ..setDidFailProvisionalNavigation((WKWebView webView, NSError error) {
-          callbacksHandler.onWebResourceError(_toWebResourceError(error));
-        })
-        ..setWebViewWebContentProcessDidTerminate((WKWebView webView) {
-          callbacksHandler.onWebResourceError(WebResourceError(
-            errorCode: WKErrorCode.webContentProcessTerminated,
-            // Value from https://developer.apple.com/documentation/webkit/wkerrordomain?language=objc.
-            domain: 'WKErrorDomain',
-            description: '',
-            errorType: WebResourceErrorType.webContentProcessTerminated,
-          ));
-        });
+    didStartProvisionalNavigation: (WKWebView webView, String? url) {
+      callbacksHandler.onPageStarted(url ?? '');
+    },
+    decidePolicyForNavigationAction: (
+      WKWebView webView,
+      WKNavigationAction action,
+    ) async {
+      if (!_hasNavigationDelegate) {
+        return WKNavigationActionPolicy.allow;
+      }
+
+      final bool allow = await callbacksHandler.onNavigationRequest(
+        url: action.request.url,
+        isForMainFrame: action.targetFrame.isMainFrame,
+      );
+
+      return allow
+          ? WKNavigationActionPolicy.allow
+          : WKNavigationActionPolicy.cancel;
+    },
+    didFailNavigation: (WKWebView webView, NSError error) {
+      callbacksHandler.onWebResourceError(_toWebResourceError(error));
+    },
+    didFailProvisionalNavigation: (WKWebView webView, NSError error) {
+      callbacksHandler.onWebResourceError(_toWebResourceError(error));
+    },
+    webViewWebContentProcessDidTerminate: (WKWebView webView) {
+      callbacksHandler.onWebResourceError(WebResourceError(
+        errorCode: WKErrorCode.webContentProcessTerminated,
+        // Value from https://developer.apple.com/documentation/webkit/wkerrordomain?language=objc.
+        domain: 'WKErrorDomain',
+        description: '',
+        errorType: WebResourceErrorType.webContentProcessTerminated,
+      ));
+    },
+  );
 
   Future<void> _setCreationParams(
     CreationParams params, {
@@ -151,17 +177,16 @@
       autoMediaPlaybackPolicy: params.autoMediaPlaybackPolicy,
     );
 
-    webView = webViewProxy.createWebView(configuration);
+    webView = webViewProxy.createWebView(configuration, observeValue: (
+      String keyPath,
+      NSObject object,
+      Map<NSKeyValueChangeKey, Object?> change,
+    ) {
+      final double progress = change[NSKeyValueChangeKey.newValue]! as double;
+      callbacksHandler.onProgress((progress * 100).round());
+    });
 
     webView.setUIDelegate(uiDelegate);
-    uiDelegate.setOnCreateWebView((
-      WKWebViewConfiguration configuration,
-      WKNavigationAction navigationAction,
-    ) {
-      if (!navigationAction.targetFrame.isMainFrame) {
-        webView.loadRequest(navigationAction.request);
-      }
-    });
 
     await addJavascriptChannels(params.javascriptChannelNames);
 
@@ -358,10 +383,11 @@
 
   @override
   Future<void> updateSettings(WebSettings setting) async {
+    if (setting.hasNavigationDelegate != null) {
+      _hasNavigationDelegate = setting.hasNavigationDelegate!;
+    }
     await Future.wait(<Future<void>>[
       _setUserAgent(setting.userAgent),
-      if (setting.hasNavigationDelegate != null)
-        _setHasNavigationDelegate(setting.hasNavigationDelegate!),
       if (setting.hasProgressTracking != null)
         _setHasProgressTracking(setting.hasProgressTracking!),
       if (setting.javascriptMode != null)
@@ -384,16 +410,15 @@
       ).map<Future<void>>(
         (String channelName) {
           final WKScriptMessageHandler handler =
-              webViewProxy.createScriptMessageHandler()
-                ..setDidReceiveScriptMessage((
-                  WKUserContentController userContentController,
-                  WKScriptMessage message,
-                ) {
-                  javascriptChannelRegistry.onJavascriptChannelMessage(
-                    message.name,
-                    message.body!.toString(),
-                  );
-                });
+              webViewProxy.createScriptMessageHandler(didReceiveScriptMessage: (
+            WKUserContentController userContentController,
+            WKScriptMessage message,
+          ) {
+            javascriptChannelRegistry.onJavascriptChannelMessage(
+              message.name,
+              message.body!.toString(),
+            );
+          });
           _scriptMessageHandlers[channelName] = handler;
 
           final String wrapperSource =
@@ -426,34 +451,8 @@
     await _resetUserScripts(removedJavaScriptChannels: javascriptChannelNames);
   }
 
-  Future<void> _setHasNavigationDelegate(bool hasNavigationDelegate) {
-    if (hasNavigationDelegate) {
-      return navigationDelegate.setDecidePolicyForNavigationAction(
-          (WKWebView webView, WKNavigationAction action) async {
-        final bool allow = await callbacksHandler.onNavigationRequest(
-          url: action.request.url,
-          isForMainFrame: action.targetFrame.isMainFrame,
-        );
-
-        return allow
-            ? WKNavigationActionPolicy.allow
-            : WKNavigationActionPolicy.cancel;
-      });
-    } else {
-      return navigationDelegate.setDecidePolicyForNavigationAction(null);
-    }
-  }
-
   Future<void> _setHasProgressTracking(bool hasProgressTracking) {
     if (hasProgressTracking) {
-      webView.setObserveValue((
-        String keyPath,
-        NSObject object,
-        Map<NSKeyValueChangeKey, Object?> change,
-      ) {
-        final double progress = change[NSKeyValueChangeKey.newValue]! as double;
-        callbacksHandler.onProgress((progress * 100).round());
-      });
       return webView.addObserver(
         webView,
         keyPath: 'estimatedProgress',
@@ -462,7 +461,6 @@
         },
       );
     } else {
-      webView.setObserveValue(null);
       return webView.removeObserver(webView, keyPath: 'estimatedProgress');
     }
   }
@@ -605,18 +603,40 @@
   const WebViewWidgetProxy();
 
   /// Constructs a [WKWebView].
-  WKWebView createWebView(WKWebViewConfiguration configuration) {
-    return WKWebView(configuration);
+  WKWebView createWebView(
+    WKWebViewConfiguration configuration, {
+    void Function(
+      String keyPath,
+      NSObject object,
+      Map<NSKeyValueChangeKey, Object?> change,
+    )?
+        observeValue,
+  }) {
+    return WKWebView(configuration, observeValue: observeValue);
   }
 
   /// Constructs a [WKScriptMessageHandler].
-  WKScriptMessageHandler createScriptMessageHandler() {
-    return WKScriptMessageHandler();
+  WKScriptMessageHandler createScriptMessageHandler({
+    required void Function(
+      WKUserContentController userContentController,
+      WKScriptMessage message,
+    )
+        didReceiveScriptMessage,
+  }) {
+    return WKScriptMessageHandler(
+      didReceiveScriptMessage: didReceiveScriptMessage,
+    );
   }
 
   /// Constructs a [WKUIDelegate].
-  WKUIDelegate createUIDelgate() {
-    return WKUIDelegate();
+  WKUIDelegate createUIDelgate({
+    void Function(
+      WKWebViewConfiguration configuration,
+      WKNavigationAction navigationAction,
+    )?
+        onCreateWebView,
+  }) {
+    return WKUIDelegate(onCreateWebView: onCreateWebView);
   }
 
   /// Constructs a [WKNavigationDelegate].
@@ -626,7 +646,26 @@
       String? url,
     )?
         didFinishNavigation,
+    void Function(WKWebView webView, String? url)?
+        didStartProvisionalNavigation,
+    Future<WKNavigationActionPolicy> Function(
+      WKWebView webView,
+      WKNavigationAction navigationAction,
+    )?
+        decidePolicyForNavigationAction,
+    void Function(WKWebView webView, NSError error)? didFailNavigation,
+    void Function(WKWebView webView, NSError error)?
+        didFailProvisionalNavigation,
+    void Function(WKWebView webView)? webViewWebContentProcessDidTerminate,
   }) {
-    return WKNavigationDelegate(didFinishNavigation: didFinishNavigation);
+    return WKNavigationDelegate(
+      didFinishNavigation: didFinishNavigation,
+      didStartProvisionalNavigation: didStartProvisionalNavigation,
+      decidePolicyForNavigationAction: decidePolicyForNavigationAction,
+      didFailNavigation: didFailNavigation,
+      didFailProvisionalNavigation: didFailProvisionalNavigation,
+      webViewWebContentProcessDidTerminate:
+          webViewWebContentProcessDidTerminate,
+    );
   }
 }
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.mocks.dart
index 7bd208e..e328a29 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.mocks.dart
+++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.mocks.dart
@@ -1,5 +1,5 @@
-// Mocks generated by Mockito 5.1.0 from annotations
-// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/src/foundation/foundation_test.dart.
+// Mocks generated by Mockito 5.2.0 from annotations
+// in webview_flutter_wkwebview/test/src/foundation/foundation_test.dart.
 // Do not manually edit this file.
 
 import 'package:mockito/mockito.dart' as _i1;
@@ -28,21 +28,21 @@
   }
 
   @override
-  void dispose(int? instanceId) =>
-      super.noSuchMethod(Invocation.method(#dispose, [instanceId]),
+  void dispose(int? identifier) =>
+      super.noSuchMethod(Invocation.method(#dispose, [identifier]),
           returnValueForMissingStub: null);
   @override
-  void addObserver(int? instanceId, int? observerInstanceId, String? keyPath,
+  void addObserver(int? identifier, int? observerIdentifier, String? keyPath,
           List<_i3.NSKeyValueObservingOptionsEnumData?>? options) =>
       super.noSuchMethod(
           Invocation.method(
-              #addObserver, [instanceId, observerInstanceId, keyPath, options]),
+              #addObserver, [identifier, observerIdentifier, keyPath, options]),
           returnValueForMissingStub: null);
   @override
   void removeObserver(
-          int? instanceId, int? observerInstanceId, String? keyPath) =>
+          int? identifier, int? observerIdentifier, String? keyPath) =>
       super.noSuchMethod(
           Invocation.method(
-              #removeObserver, [instanceId, observerInstanceId, keyPath]),
+              #removeObserver, [identifier, observerIdentifier, keyPath]),
           returnValueForMissingStub: null);
 }
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart
index a9f9b2c..58939f5 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart
+++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.mocks.dart
@@ -1,5 +1,5 @@
-// Mocks generated by Mockito 5.1.0 from annotations
-// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.dart.
+// Mocks generated by Mockito 5.2.0 from annotations
+// in webview_flutter_wkwebview/test/src/ui_kit/ui_kit_test.dart.
 // Do not manually edit this file.
 
 import 'dart:async' as _i4;
@@ -30,26 +30,26 @@
   }
 
   @override
-  void create(int? instanceId) =>
-      super.noSuchMethod(Invocation.method(#create, [instanceId]),
+  void create(int? identifier) =>
+      super.noSuchMethod(Invocation.method(#create, [identifier]),
           returnValueForMissingStub: null);
   @override
-  void createFromWebView(int? instanceId, int? webViewInstanceId) =>
+  void createFromWebView(int? identifier, int? webViewIdentifier) =>
       super.noSuchMethod(
           Invocation.method(
-              #createFromWebView, [instanceId, webViewInstanceId]),
+              #createFromWebView, [identifier, webViewIdentifier]),
           returnValueForMissingStub: null);
   @override
-  void setAllowsInlineMediaPlayback(int? instanceId, bool? allow) =>
+  void setAllowsInlineMediaPlayback(int? identifier, bool? allow) =>
       super.noSuchMethod(
-          Invocation.method(#setAllowsInlineMediaPlayback, [instanceId, allow]),
+          Invocation.method(#setAllowsInlineMediaPlayback, [identifier, allow]),
           returnValueForMissingStub: null);
   @override
   void setMediaTypesRequiringUserActionForPlayback(
-          int? instanceId, List<_i3.WKAudiovisualMediaTypeEnumData?>? types) =>
+          int? identifier, List<_i3.WKAudiovisualMediaTypeEnumData?>? types) =>
       super.noSuchMethod(
           Invocation.method(#setMediaTypesRequiringUserActionForPlayback,
-              [instanceId, types]),
+              [identifier, types]),
           returnValueForMissingStub: null);
 }
 
@@ -63,88 +63,88 @@
   }
 
   @override
-  void create(int? instanceId, int? configurationInstanceId) =>
+  void create(int? identifier, int? configurationIdentifier) =>
       super.noSuchMethod(
-          Invocation.method(#create, [instanceId, configurationInstanceId]),
+          Invocation.method(#create, [identifier, configurationIdentifier]),
           returnValueForMissingStub: null);
   @override
-  void setUIDelegate(int? instanceId, int? uiDelegateInstanceId) =>
+  void setUIDelegate(int? identifier, int? uiDelegateIdentifier) =>
       super.noSuchMethod(
-          Invocation.method(#setUIDelegate, [instanceId, uiDelegateInstanceId]),
+          Invocation.method(#setUIDelegate, [identifier, uiDelegateIdentifier]),
           returnValueForMissingStub: null);
   @override
   void setNavigationDelegate(
-          int? instanceId, int? navigationDelegateInstanceId) =>
+          int? identifier, int? navigationDelegateIdentifier) =>
       super.noSuchMethod(
           Invocation.method(#setNavigationDelegate,
-              [instanceId, navigationDelegateInstanceId]),
+              [identifier, navigationDelegateIdentifier]),
           returnValueForMissingStub: null);
   @override
-  String? getUrl(int? instanceId) =>
-      (super.noSuchMethod(Invocation.method(#getUrl, [instanceId])) as String?);
+  String? getUrl(int? identifier) =>
+      (super.noSuchMethod(Invocation.method(#getUrl, [identifier])) as String?);
   @override
-  double getEstimatedProgress(int? instanceId) => (super.noSuchMethod(
-      Invocation.method(#getEstimatedProgress, [instanceId]),
+  double getEstimatedProgress(int? identifier) => (super.noSuchMethod(
+      Invocation.method(#getEstimatedProgress, [identifier]),
       returnValue: 0.0) as double);
   @override
-  void loadRequest(int? instanceId, _i3.NSUrlRequestData? request) =>
-      super.noSuchMethod(Invocation.method(#loadRequest, [instanceId, request]),
+  void loadRequest(int? identifier, _i3.NSUrlRequestData? request) =>
+      super.noSuchMethod(Invocation.method(#loadRequest, [identifier, request]),
           returnValueForMissingStub: null);
   @override
-  void loadHtmlString(int? instanceId, String? string, String? baseUrl) =>
+  void loadHtmlString(int? identifier, String? string, String? baseUrl) =>
       super.noSuchMethod(
-          Invocation.method(#loadHtmlString, [instanceId, string, baseUrl]),
+          Invocation.method(#loadHtmlString, [identifier, string, baseUrl]),
           returnValueForMissingStub: null);
   @override
-  void loadFileUrl(int? instanceId, String? url, String? readAccessUrl) =>
+  void loadFileUrl(int? identifier, String? url, String? readAccessUrl) =>
       super.noSuchMethod(
-          Invocation.method(#loadFileUrl, [instanceId, url, readAccessUrl]),
+          Invocation.method(#loadFileUrl, [identifier, url, readAccessUrl]),
           returnValueForMissingStub: null);
   @override
-  void loadFlutterAsset(int? instanceId, String? key) => super.noSuchMethod(
-      Invocation.method(#loadFlutterAsset, [instanceId, key]),
+  void loadFlutterAsset(int? identifier, String? key) => super.noSuchMethod(
+      Invocation.method(#loadFlutterAsset, [identifier, key]),
       returnValueForMissingStub: null);
   @override
-  bool canGoBack(int? instanceId) =>
-      (super.noSuchMethod(Invocation.method(#canGoBack, [instanceId]),
+  bool canGoBack(int? identifier) =>
+      (super.noSuchMethod(Invocation.method(#canGoBack, [identifier]),
           returnValue: false) as bool);
   @override
-  bool canGoForward(int? instanceId) =>
-      (super.noSuchMethod(Invocation.method(#canGoForward, [instanceId]),
+  bool canGoForward(int? identifier) =>
+      (super.noSuchMethod(Invocation.method(#canGoForward, [identifier]),
           returnValue: false) as bool);
   @override
-  void goBack(int? instanceId) =>
-      super.noSuchMethod(Invocation.method(#goBack, [instanceId]),
+  void goBack(int? identifier) =>
+      super.noSuchMethod(Invocation.method(#goBack, [identifier]),
           returnValueForMissingStub: null);
   @override
-  void goForward(int? instanceId) =>
-      super.noSuchMethod(Invocation.method(#goForward, [instanceId]),
+  void goForward(int? identifier) =>
+      super.noSuchMethod(Invocation.method(#goForward, [identifier]),
           returnValueForMissingStub: null);
   @override
-  void reload(int? instanceId) =>
-      super.noSuchMethod(Invocation.method(#reload, [instanceId]),
+  void reload(int? identifier) =>
+      super.noSuchMethod(Invocation.method(#reload, [identifier]),
           returnValueForMissingStub: null);
   @override
-  String? getTitle(int? instanceId) =>
-      (super.noSuchMethod(Invocation.method(#getTitle, [instanceId]))
+  String? getTitle(int? identifier) =>
+      (super.noSuchMethod(Invocation.method(#getTitle, [identifier]))
           as String?);
   @override
-  void setAllowsBackForwardNavigationGestures(int? instanceId, bool? allow) =>
+  void setAllowsBackForwardNavigationGestures(int? identifier, bool? allow) =>
       super.noSuchMethod(
           Invocation.method(
-              #setAllowsBackForwardNavigationGestures, [instanceId, allow]),
+              #setAllowsBackForwardNavigationGestures, [identifier, allow]),
           returnValueForMissingStub: null);
   @override
-  void setCustomUserAgent(int? instanceId, String? userAgent) =>
+  void setCustomUserAgent(int? identifier, String? userAgent) =>
       super.noSuchMethod(
-          Invocation.method(#setCustomUserAgent, [instanceId, userAgent]),
+          Invocation.method(#setCustomUserAgent, [identifier, userAgent]),
           returnValueForMissingStub: null);
   @override
   _i4.Future<Object?> evaluateJavaScript(
-          int? instanceId, String? javaScriptString) =>
+          int? identifier, String? javaScriptString) =>
       (super.noSuchMethod(
           Invocation.method(
-              #evaluateJavaScript, [instanceId, javaScriptString]),
+              #evaluateJavaScript, [identifier, javaScriptString]),
           returnValue: Future<Object?>.value()) as _i4.Future<Object?>);
 }
 
@@ -158,22 +158,22 @@
   }
 
   @override
-  void createFromWebView(int? instanceId, int? webViewInstanceId) =>
+  void createFromWebView(int? identifier, int? webViewIdentifier) =>
       super.noSuchMethod(
           Invocation.method(
-              #createFromWebView, [instanceId, webViewInstanceId]),
+              #createFromWebView, [identifier, webViewIdentifier]),
           returnValueForMissingStub: null);
   @override
-  List<double?> getContentOffset(int? instanceId) =>
-      (super.noSuchMethod(Invocation.method(#getContentOffset, [instanceId]),
+  List<double?> getContentOffset(int? identifier) =>
+      (super.noSuchMethod(Invocation.method(#getContentOffset, [identifier]),
           returnValue: <double?>[]) as List<double?>);
   @override
-  void scrollBy(int? instanceId, double? x, double? y) =>
-      super.noSuchMethod(Invocation.method(#scrollBy, [instanceId, x, y]),
+  void scrollBy(int? identifier, double? x, double? y) =>
+      super.noSuchMethod(Invocation.method(#scrollBy, [identifier, x, y]),
           returnValueForMissingStub: null);
   @override
-  void setContentOffset(int? instanceId, double? x, double? y) => super
-      .noSuchMethod(Invocation.method(#setContentOffset, [instanceId, x, y]),
+  void setContentOffset(int? identifier, double? x, double? y) => super
+      .noSuchMethod(Invocation.method(#setContentOffset, [identifier, x, y]),
           returnValueForMissingStub: null);
 }
 
@@ -186,11 +186,11 @@
   }
 
   @override
-  void setBackgroundColor(int? instanceId, int? value) => super.noSuchMethod(
-      Invocation.method(#setBackgroundColor, [instanceId, value]),
+  void setBackgroundColor(int? identifier, int? value) => super.noSuchMethod(
+      Invocation.method(#setBackgroundColor, [identifier, value]),
       returnValueForMissingStub: null);
   @override
-  void setOpaque(int? instanceId, bool? opaque) =>
-      super.noSuchMethod(Invocation.method(#setOpaque, [instanceId, opaque]),
+  void setOpaque(int? identifier, bool? opaque) =>
+      super.noSuchMethod(Invocation.method(#setOpaque, [identifier, opaque]),
           returnValueForMissingStub: null);
 }
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart
index f486474..cf417c4 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart
+++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart
@@ -186,6 +186,7 @@
         TestWKScriptMessageHandlerHostApi.setup(mockPlatformHostApi);
 
         scriptMessageHandler = WKScriptMessageHandler(
+          didReceiveScriptMessage: (_, __) {},
           instanceManager: instanceManager,
         );
       });
@@ -288,6 +289,7 @@
           MockTestWKScriptMessageHandlerHostApi(),
         );
         final WKScriptMessageHandler handler = WKScriptMessageHandler(
+          didReceiveScriptMessage: (_, __) {},
           instanceManager: instanceManager,
         );
 
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart
index 16d80b2..39ba08f 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart
+++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.mocks.dart
@@ -1,5 +1,5 @@
-// Mocks generated by Mockito 5.1.0 from annotations
-// in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart.
+// Mocks generated by Mockito 5.2.0 from annotations
+// in webview_flutter_wkwebview/test/src/web_kit/web_kit_test.dart.
 // Do not manually edit this file.
 
 import 'dart:async' as _i3;
@@ -31,14 +31,14 @@
 
   @override
   void createFromWebsiteDataStore(
-          int? instanceId, int? websiteDataStoreInstanceId) =>
+          int? identifier, int? websiteDataStoreIdentifier) =>
       super.noSuchMethod(
           Invocation.method(#createFromWebsiteDataStore,
-              [instanceId, websiteDataStoreInstanceId]),
+              [identifier, websiteDataStoreIdentifier]),
           returnValueForMissingStub: null);
   @override
-  _i3.Future<void> setCookie(int? instanceId, _i4.NSHttpCookieData? cookie) =>
-      (super.noSuchMethod(Invocation.method(#setCookie, [instanceId, cookie]),
+  _i3.Future<void> setCookie(int? identifier, _i4.NSHttpCookieData? cookie) =>
+      (super.noSuchMethod(Invocation.method(#setCookie, [identifier, cookie]),
           returnValue: Future<void>.value(),
           returnValueForMissingStub: Future<void>.value()) as _i3.Future<void>);
 }
@@ -53,8 +53,8 @@
   }
 
   @override
-  void create(int? instanceId) =>
-      super.noSuchMethod(Invocation.method(#create, [instanceId]),
+  void create(int? identifier) =>
+      super.noSuchMethod(Invocation.method(#create, [identifier]),
           returnValueForMissingStub: null);
 }
 
@@ -69,15 +69,15 @@
 
   @override
   void createFromWebViewConfiguration(
-          int? instanceId, int? configurationInstanceId) =>
+          int? identifier, int? configurationIdentifier) =>
       super.noSuchMethod(
           Invocation.method(#createFromWebViewConfiguration,
-              [instanceId, configurationInstanceId]),
+              [identifier, configurationIdentifier]),
           returnValueForMissingStub: null);
   @override
-  void setJavaScriptEnabled(int? instanceId, bool? enabled) =>
+  void setJavaScriptEnabled(int? identifier, bool? enabled) =>
       super.noSuchMethod(
-          Invocation.method(#setJavaScriptEnabled, [instanceId, enabled]),
+          Invocation.method(#setJavaScriptEnabled, [identifier, enabled]),
           returnValueForMissingStub: null);
 }
 
@@ -91,8 +91,8 @@
   }
 
   @override
-  void create(int? instanceId) =>
-      super.noSuchMethod(Invocation.method(#create, [instanceId]),
+  void create(int? identifier) =>
+      super.noSuchMethod(Invocation.method(#create, [identifier]),
           returnValueForMissingStub: null);
 }
 
@@ -106,8 +106,8 @@
   }
 
   @override
-  void create(int? instanceId) =>
-      super.noSuchMethod(Invocation.method(#create, [instanceId]),
+  void create(int? identifier) =>
+      super.noSuchMethod(Invocation.method(#create, [identifier]),
           returnValueForMissingStub: null);
 }
 
@@ -122,34 +122,34 @@
 
   @override
   void createFromWebViewConfiguration(
-          int? instanceId, int? configurationInstanceId) =>
+          int? identifier, int? configurationIdentifier) =>
       super.noSuchMethod(
           Invocation.method(#createFromWebViewConfiguration,
-              [instanceId, configurationInstanceId]),
+              [identifier, configurationIdentifier]),
           returnValueForMissingStub: null);
   @override
   void addScriptMessageHandler(
-          int? instanceId, int? handlerInstanceid, String? name) =>
+          int? identifier, int? handlerIdentifier, String? name) =>
       super.noSuchMethod(
           Invocation.method(
-              #addScriptMessageHandler, [instanceId, handlerInstanceid, name]),
+              #addScriptMessageHandler, [identifier, handlerIdentifier, name]),
           returnValueForMissingStub: null);
   @override
-  void removeScriptMessageHandler(int? instanceId, String? name) =>
+  void removeScriptMessageHandler(int? identifier, String? name) =>
       super.noSuchMethod(
-          Invocation.method(#removeScriptMessageHandler, [instanceId, name]),
+          Invocation.method(#removeScriptMessageHandler, [identifier, name]),
           returnValueForMissingStub: null);
   @override
-  void removeAllScriptMessageHandlers(int? instanceId) => super.noSuchMethod(
-      Invocation.method(#removeAllScriptMessageHandlers, [instanceId]),
+  void removeAllScriptMessageHandlers(int? identifier) => super.noSuchMethod(
+      Invocation.method(#removeAllScriptMessageHandlers, [identifier]),
       returnValueForMissingStub: null);
   @override
-  void addUserScript(int? instanceId, _i4.WKUserScriptData? userScript) => super
-      .noSuchMethod(Invocation.method(#addUserScript, [instanceId, userScript]),
+  void addUserScript(int? identifier, _i4.WKUserScriptData? userScript) => super
+      .noSuchMethod(Invocation.method(#addUserScript, [identifier, userScript]),
           returnValueForMissingStub: null);
   @override
-  void removeAllUserScripts(int? instanceId) =>
-      super.noSuchMethod(Invocation.method(#removeAllUserScripts, [instanceId]),
+  void removeAllUserScripts(int? identifier) =>
+      super.noSuchMethod(Invocation.method(#removeAllUserScripts, [identifier]),
           returnValueForMissingStub: null);
 }
 
@@ -163,26 +163,26 @@
   }
 
   @override
-  void create(int? instanceId) =>
-      super.noSuchMethod(Invocation.method(#create, [instanceId]),
+  void create(int? identifier) =>
+      super.noSuchMethod(Invocation.method(#create, [identifier]),
           returnValueForMissingStub: null);
   @override
-  void createFromWebView(int? instanceId, int? webViewInstanceId) =>
+  void createFromWebView(int? identifier, int? webViewIdentifier) =>
       super.noSuchMethod(
           Invocation.method(
-              #createFromWebView, [instanceId, webViewInstanceId]),
+              #createFromWebView, [identifier, webViewIdentifier]),
           returnValueForMissingStub: null);
   @override
-  void setAllowsInlineMediaPlayback(int? instanceId, bool? allow) =>
+  void setAllowsInlineMediaPlayback(int? identifier, bool? allow) =>
       super.noSuchMethod(
-          Invocation.method(#setAllowsInlineMediaPlayback, [instanceId, allow]),
+          Invocation.method(#setAllowsInlineMediaPlayback, [identifier, allow]),
           returnValueForMissingStub: null);
   @override
   void setMediaTypesRequiringUserActionForPlayback(
-          int? instanceId, List<_i4.WKAudiovisualMediaTypeEnumData?>? types) =>
+          int? identifier, List<_i4.WKAudiovisualMediaTypeEnumData?>? types) =>
       super.noSuchMethod(
           Invocation.method(#setMediaTypesRequiringUserActionForPlayback,
-              [instanceId, types]),
+              [identifier, types]),
           returnValueForMissingStub: null);
 }
 
@@ -196,88 +196,88 @@
   }
 
   @override
-  void create(int? instanceId, int? configurationInstanceId) =>
+  void create(int? identifier, int? configurationIdentifier) =>
       super.noSuchMethod(
-          Invocation.method(#create, [instanceId, configurationInstanceId]),
+          Invocation.method(#create, [identifier, configurationIdentifier]),
           returnValueForMissingStub: null);
   @override
-  void setUIDelegate(int? instanceId, int? uiDelegateInstanceId) =>
+  void setUIDelegate(int? identifier, int? uiDelegateIdentifier) =>
       super.noSuchMethod(
-          Invocation.method(#setUIDelegate, [instanceId, uiDelegateInstanceId]),
+          Invocation.method(#setUIDelegate, [identifier, uiDelegateIdentifier]),
           returnValueForMissingStub: null);
   @override
   void setNavigationDelegate(
-          int? instanceId, int? navigationDelegateInstanceId) =>
+          int? identifier, int? navigationDelegateIdentifier) =>
       super.noSuchMethod(
           Invocation.method(#setNavigationDelegate,
-              [instanceId, navigationDelegateInstanceId]),
+              [identifier, navigationDelegateIdentifier]),
           returnValueForMissingStub: null);
   @override
-  String? getUrl(int? instanceId) =>
-      (super.noSuchMethod(Invocation.method(#getUrl, [instanceId])) as String?);
+  String? getUrl(int? identifier) =>
+      (super.noSuchMethod(Invocation.method(#getUrl, [identifier])) as String?);
   @override
-  double getEstimatedProgress(int? instanceId) => (super.noSuchMethod(
-      Invocation.method(#getEstimatedProgress, [instanceId]),
+  double getEstimatedProgress(int? identifier) => (super.noSuchMethod(
+      Invocation.method(#getEstimatedProgress, [identifier]),
       returnValue: 0.0) as double);
   @override
-  void loadRequest(int? instanceId, _i4.NSUrlRequestData? request) =>
-      super.noSuchMethod(Invocation.method(#loadRequest, [instanceId, request]),
+  void loadRequest(int? identifier, _i4.NSUrlRequestData? request) =>
+      super.noSuchMethod(Invocation.method(#loadRequest, [identifier, request]),
           returnValueForMissingStub: null);
   @override
-  void loadHtmlString(int? instanceId, String? string, String? baseUrl) =>
+  void loadHtmlString(int? identifier, String? string, String? baseUrl) =>
       super.noSuchMethod(
-          Invocation.method(#loadHtmlString, [instanceId, string, baseUrl]),
+          Invocation.method(#loadHtmlString, [identifier, string, baseUrl]),
           returnValueForMissingStub: null);
   @override
-  void loadFileUrl(int? instanceId, String? url, String? readAccessUrl) =>
+  void loadFileUrl(int? identifier, String? url, String? readAccessUrl) =>
       super.noSuchMethod(
-          Invocation.method(#loadFileUrl, [instanceId, url, readAccessUrl]),
+          Invocation.method(#loadFileUrl, [identifier, url, readAccessUrl]),
           returnValueForMissingStub: null);
   @override
-  void loadFlutterAsset(int? instanceId, String? key) => super.noSuchMethod(
-      Invocation.method(#loadFlutterAsset, [instanceId, key]),
+  void loadFlutterAsset(int? identifier, String? key) => super.noSuchMethod(
+      Invocation.method(#loadFlutterAsset, [identifier, key]),
       returnValueForMissingStub: null);
   @override
-  bool canGoBack(int? instanceId) =>
-      (super.noSuchMethod(Invocation.method(#canGoBack, [instanceId]),
+  bool canGoBack(int? identifier) =>
+      (super.noSuchMethod(Invocation.method(#canGoBack, [identifier]),
           returnValue: false) as bool);
   @override
-  bool canGoForward(int? instanceId) =>
-      (super.noSuchMethod(Invocation.method(#canGoForward, [instanceId]),
+  bool canGoForward(int? identifier) =>
+      (super.noSuchMethod(Invocation.method(#canGoForward, [identifier]),
           returnValue: false) as bool);
   @override
-  void goBack(int? instanceId) =>
-      super.noSuchMethod(Invocation.method(#goBack, [instanceId]),
+  void goBack(int? identifier) =>
+      super.noSuchMethod(Invocation.method(#goBack, [identifier]),
           returnValueForMissingStub: null);
   @override
-  void goForward(int? instanceId) =>
-      super.noSuchMethod(Invocation.method(#goForward, [instanceId]),
+  void goForward(int? identifier) =>
+      super.noSuchMethod(Invocation.method(#goForward, [identifier]),
           returnValueForMissingStub: null);
   @override
-  void reload(int? instanceId) =>
-      super.noSuchMethod(Invocation.method(#reload, [instanceId]),
+  void reload(int? identifier) =>
+      super.noSuchMethod(Invocation.method(#reload, [identifier]),
           returnValueForMissingStub: null);
   @override
-  String? getTitle(int? instanceId) =>
-      (super.noSuchMethod(Invocation.method(#getTitle, [instanceId]))
+  String? getTitle(int? identifier) =>
+      (super.noSuchMethod(Invocation.method(#getTitle, [identifier]))
           as String?);
   @override
-  void setAllowsBackForwardNavigationGestures(int? instanceId, bool? allow) =>
+  void setAllowsBackForwardNavigationGestures(int? identifier, bool? allow) =>
       super.noSuchMethod(
           Invocation.method(
-              #setAllowsBackForwardNavigationGestures, [instanceId, allow]),
+              #setAllowsBackForwardNavigationGestures, [identifier, allow]),
           returnValueForMissingStub: null);
   @override
-  void setCustomUserAgent(int? instanceId, String? userAgent) =>
+  void setCustomUserAgent(int? identifier, String? userAgent) =>
       super.noSuchMethod(
-          Invocation.method(#setCustomUserAgent, [instanceId, userAgent]),
+          Invocation.method(#setCustomUserAgent, [identifier, userAgent]),
           returnValueForMissingStub: null);
   @override
   _i3.Future<Object?> evaluateJavaScript(
-          int? instanceId, String? javaScriptString) =>
+          int? identifier, String? javaScriptString) =>
       (super.noSuchMethod(
           Invocation.method(
-              #evaluateJavaScript, [instanceId, javaScriptString]),
+              #evaluateJavaScript, [identifier, javaScriptString]),
           returnValue: Future<Object?>.value()) as _i3.Future<Object?>);
 }
 
@@ -292,22 +292,22 @@
 
   @override
   void createFromWebViewConfiguration(
-          int? instanceId, int? configurationInstanceId) =>
+          int? identifier, int? configurationIdentifier) =>
       super.noSuchMethod(
           Invocation.method(#createFromWebViewConfiguration,
-              [instanceId, configurationInstanceId]),
+              [identifier, configurationIdentifier]),
           returnValueForMissingStub: null);
   @override
-  void createDefaultDataStore(int? instanceId) => super.noSuchMethod(
-      Invocation.method(#createDefaultDataStore, [instanceId]),
+  void createDefaultDataStore(int? identifier) => super.noSuchMethod(
+      Invocation.method(#createDefaultDataStore, [identifier]),
       returnValueForMissingStub: null);
   @override
   _i3.Future<bool> removeDataOfTypes(
-          int? instanceId,
+          int? identifier,
           List<_i4.WKWebsiteDataTypeEnumData?>? dataTypes,
           double? modificationTimeInSecondsSinceEpoch) =>
       (super.noSuchMethod(
           Invocation.method(#removeDataOfTypes,
-              [instanceId, dataTypes, modificationTimeInSecondsSinceEpoch]),
+              [identifier, dataTypes, modificationTimeInSecondsSinceEpoch]),
           returnValue: Future<bool>.value(false)) as _i3.Future<bool>);
 }
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.mocks.dart
index 5989c13..b0c63b6 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.mocks.dart
+++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.mocks.dart
@@ -1,4 +1,4 @@
-// Mocks generated by Mockito 5.1.0 from annotations
+// Mocks generated by Mockito 5.2.0 from annotations
 // in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/src/web_kit_cookie_manager_test.dart.
 // Do not manually edit this file.
 
@@ -54,14 +54,6 @@
           returnValue: Future<void>.value(),
           returnValueForMissingStub: Future<void>.value()) as _i4.Future<void>);
   @override
-  _i4.Future<void> setObserveValue(
-          void Function(
-                  String, _i5.NSObject, Map<_i5.NSKeyValueChangeKey, Object?>)?
-              observeValue) =>
-      (super.noSuchMethod(Invocation.method(#setObserveValue, [observeValue]),
-          returnValue: Future<void>.value(),
-          returnValueForMissingStub: Future<void>.value()) as _i4.Future<void>);
-  @override
   _i2.Copyable copy() => (super.noSuchMethod(Invocation.method(#copy, []),
       returnValue: _FakeCopyable_0()) as _i2.Copyable);
 }
@@ -100,14 +92,6 @@
           returnValue: Future<void>.value(),
           returnValueForMissingStub: Future<void>.value()) as _i4.Future<void>);
   @override
-  _i4.Future<void> setObserveValue(
-          void Function(
-                  String, _i5.NSObject, Map<_i5.NSKeyValueChangeKey, Object?>)?
-              observeValue) =>
-      (super.noSuchMethod(Invocation.method(#setObserveValue, [observeValue]),
-          returnValue: Future<void>.value(),
-          returnValueForMissingStub: Future<void>.value()) as _i4.Future<void>);
-  @override
   _i2.Copyable copy() => (super.noSuchMethod(Invocation.method(#copy, []),
       returnValue: _FakeCopyable_0()) as _i2.Copyable);
 }
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.dart
index 6af5f7d..c1cdfc5 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.dart
+++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.dart
@@ -62,10 +62,27 @@
       mockNavigationDelegate = MockWKNavigationDelegate();
       mockWebViewWidgetProxy = MockWebViewWidgetProxy();
 
-      when(mockWebViewWidgetProxy.createWebView(any)).thenReturn(mockWebView);
-      when(mockWebViewWidgetProxy.createUIDelgate()).thenReturn(mockUIDelegate);
+      when(
+        mockWebViewWidgetProxy.createWebView(
+          any,
+          observeValue: anyNamed('observeValue'),
+        ),
+      ).thenReturn(mockWebView);
+      when(
+        mockWebViewWidgetProxy.createUIDelgate(
+          onCreateWebView: captureAnyNamed('onCreateWebView'),
+        ),
+      ).thenReturn(mockUIDelegate);
       when(mockWebViewWidgetProxy.createNavigationDelegate(
         didFinishNavigation: anyNamed('didFinishNavigation'),
+        didStartProvisionalNavigation:
+            anyNamed('didStartProvisionalNavigation'),
+        decidePolicyForNavigationAction:
+            anyNamed('decidePolicyForNavigationAction'),
+        didFailNavigation: anyNamed('didFailNavigation'),
+        didFailProvisionalNavigation: anyNamed('didFailProvisionalNavigation'),
+        webViewWebContentProcessDidTerminate:
+            anyNamed('webViewWebContentProcessDidTerminate'),
       )).thenReturn(mockNavigationDelegate);
       when(mockWebView.configuration).thenReturn(mockWebViewConfiguration);
       when(mockWebViewConfiguration.userContentController).thenReturn(
@@ -118,9 +135,11 @@
         (WidgetTester tester) async {
       await buildWidget(tester);
 
-      final dynamic onCreateWebView =
-          verify(mockUIDelegate.setOnCreateWebView(captureAny)).captured.single
-              as void Function(WKWebViewConfiguration, WKNavigationAction);
+      final dynamic onCreateWebView = verify(
+              mockWebViewWidgetProxy.createUIDelgate(
+                  onCreateWebView: captureAnyNamed('onCreateWebView')))
+          .captured
+          .single as void Function(WKWebViewConfiguration, WKNavigationAction);
 
       const NSUrlRequest request = NSUrlRequest(url: 'https://google.com');
       onCreateWebView(
@@ -224,7 +243,11 @@
       });
 
       testWidgets('javascriptChannelNames', (WidgetTester tester) async {
-        when(mockWebViewWidgetProxy.createScriptMessageHandler()).thenReturn(
+        when(
+          mockWebViewWidgetProxy.createScriptMessageHandler(
+            didReceiveScriptMessage: anyNamed('didReceiveScriptMessage'),
+          ),
+        ).thenReturn(
           MockWKScriptMessageHandler(),
         );
 
@@ -273,21 +296,6 @@
           verify(mockPreferences.setJavaScriptEnabled(true));
         });
 
-        testWidgets('hasNavigationDelegate', (WidgetTester tester) async {
-          await buildWidget(
-            tester,
-            creationParams: CreationParams(
-              webSettings: WebSettings(
-                userAgent: const WebSetting<String?>.absent(),
-                hasNavigationDelegate: true,
-              ),
-            ),
-          );
-
-          verify(mockNavigationDelegate
-              .setDecidePolicyForNavigationAction(argThat(isNotNull)));
-        });
-
         testWidgets('userAgent', (WidgetTester tester) async {
           await buildWidget(
             tester,
@@ -305,8 +313,11 @@
         testWidgets(
           'enabling zoom re-adds JavaScript channels',
           (WidgetTester tester) async {
-            when(mockWebViewWidgetProxy.createScriptMessageHandler())
-                .thenReturn(
+            when(
+              mockWebViewWidgetProxy.createScriptMessageHandler(
+                didReceiveScriptMessage: anyNamed('didReceiveScriptMessage'),
+              ),
+            ).thenReturn(
               MockWKScriptMessageHandler(),
             );
 
@@ -783,7 +794,11 @@
       });
 
       testWidgets('addJavascriptChannels', (WidgetTester tester) async {
-        when(mockWebViewWidgetProxy.createScriptMessageHandler()).thenReturn(
+        when(
+          mockWebViewWidgetProxy.createScriptMessageHandler(
+            didReceiveScriptMessage: anyNamed('didReceiveScriptMessage'),
+          ),
+        ).thenReturn(
           MockWKScriptMessageHandler(),
         );
 
@@ -824,7 +839,11 @@
       });
 
       testWidgets('removeJavascriptChannels', (WidgetTester tester) async {
-        when(mockWebViewWidgetProxy.createScriptMessageHandler()).thenReturn(
+        when(
+          mockWebViewWidgetProxy.createScriptMessageHandler(
+            didReceiveScriptMessage: anyNamed('didReceiveScriptMessage'),
+          ),
+        ).thenReturn(
           MockWKScriptMessageHandler(),
         );
 
@@ -865,7 +884,11 @@
 
       testWidgets('removeJavascriptChannels with zoom disabled',
           (WidgetTester tester) async {
-        when(mockWebViewWidgetProxy.createScriptMessageHandler()).thenReturn(
+        when(
+          mockWebViewWidgetProxy.createScriptMessageHandler(
+            didReceiveScriptMessage: anyNamed('didReceiveScriptMessage'),
+          ),
+        ).thenReturn(
           MockWKScriptMessageHandler(),
         );
 
@@ -906,11 +929,19 @@
       testWidgets('onPageStarted', (WidgetTester tester) async {
         await buildWidget(tester);
 
-        final dynamic didStartProvisionalNavigation = verify(
-                mockNavigationDelegate
-                    .setDidStartProvisionalNavigation(captureAny))
-            .captured
-            .single as void Function(WKWebView, String);
+        final dynamic didStartProvisionalNavigation =
+            verify(mockWebViewWidgetProxy.createNavigationDelegate(
+          didFinishNavigation: anyNamed('didFinishNavigation'),
+          didStartProvisionalNavigation:
+              captureAnyNamed('didStartProvisionalNavigation'),
+          decidePolicyForNavigationAction:
+              anyNamed('decidePolicyForNavigationAction'),
+          didFailNavigation: anyNamed('didFailNavigation'),
+          didFailProvisionalNavigation:
+              anyNamed('didFailProvisionalNavigation'),
+          webViewWebContentProcessDidTerminate:
+              anyNamed('webViewWebContentProcessDidTerminate'),
+        )).captured.single as void Function(WKWebView, String);
         didStartProvisionalNavigation(mockWebView, 'https://google.com');
 
         verify(mockCallbacksHandler.onPageStarted('https://google.com'));
@@ -922,6 +953,15 @@
         final dynamic didFinishNavigation =
             verify(mockWebViewWidgetProxy.createNavigationDelegate(
           didFinishNavigation: captureAnyNamed('didFinishNavigation'),
+          didStartProvisionalNavigation:
+              anyNamed('didStartProvisionalNavigation'),
+          decidePolicyForNavigationAction:
+              anyNamed('decidePolicyForNavigationAction'),
+          didFailNavigation: anyNamed('didFailNavigation'),
+          didFailProvisionalNavigation:
+              anyNamed('didFailProvisionalNavigation'),
+          webViewWebContentProcessDidTerminate:
+              anyNamed('webViewWebContentProcessDidTerminate'),
         )).captured.single as void Function(WKWebView, String);
         didFinishNavigation(mockWebView, 'https://google.com');
 
@@ -933,9 +973,18 @@
         await buildWidget(tester);
 
         final dynamic didFailNavigation =
-            verify(mockNavigationDelegate.setDidFailNavigation(captureAny))
-                .captured
-                .single as void Function(WKWebView, NSError);
+            verify(mockWebViewWidgetProxy.createNavigationDelegate(
+          didFinishNavigation: anyNamed('didFinishNavigation'),
+          didStartProvisionalNavigation:
+              anyNamed('didStartProvisionalNavigation'),
+          decidePolicyForNavigationAction:
+              anyNamed('decidePolicyForNavigationAction'),
+          didFailNavigation: captureAnyNamed('didFailNavigation'),
+          didFailProvisionalNavigation:
+              anyNamed('didFailProvisionalNavigation'),
+          webViewWebContentProcessDidTerminate:
+              anyNamed('webViewWebContentProcessDidTerminate'),
+        )).captured.single as void Function(WKWebView, NSError);
 
         didFailNavigation(
           mockWebView,
@@ -960,11 +1009,19 @@
           (WidgetTester tester) async {
         await buildWidget(tester);
 
-        final dynamic didFailProvisionalNavigation = verify(
-                mockNavigationDelegate
-                    .setDidFailProvisionalNavigation(captureAny))
-            .captured
-            .single as void Function(WKWebView, NSError);
+        final dynamic didFailProvisionalNavigation =
+            verify(mockWebViewWidgetProxy.createNavigationDelegate(
+          didFinishNavigation: anyNamed('didFinishNavigation'),
+          didStartProvisionalNavigation:
+              anyNamed('didStartProvisionalNavigation'),
+          decidePolicyForNavigationAction:
+              anyNamed('decidePolicyForNavigationAction'),
+          didFailNavigation: anyNamed('didFailNavigation'),
+          didFailProvisionalNavigation:
+              captureAnyNamed('didFailProvisionalNavigation'),
+          webViewWebContentProcessDidTerminate:
+              anyNamed('webViewWebContentProcessDidTerminate'),
+        )).captured.single as void Function(WKWebView, NSError);
 
         didFailProvisionalNavigation(
           mockWebView,
@@ -993,11 +1050,19 @@
           (WidgetTester tester) async {
         await buildWidget(tester);
 
-        final dynamic webViewWebContentProcessDidTerminate = verify(
-                mockNavigationDelegate
-                    .setWebViewWebContentProcessDidTerminate(captureAny))
-            .captured
-            .single as void Function(WKWebView);
+        final dynamic webViewWebContentProcessDidTerminate =
+            verify(mockWebViewWidgetProxy.createNavigationDelegate(
+          didFinishNavigation: anyNamed('didFinishNavigation'),
+          didStartProvisionalNavigation:
+              anyNamed('didStartProvisionalNavigation'),
+          decidePolicyForNavigationAction:
+              anyNamed('decidePolicyForNavigationAction'),
+          didFailNavigation: anyNamed('didFailNavigation'),
+          didFailProvisionalNavigation:
+              anyNamed('didFailProvisionalNavigation'),
+          webViewWebContentProcessDidTerminate:
+              captureAnyNamed('webViewWebContentProcessDidTerminate'),
+        )).captured.single as void Function(WKWebView);
         webViewWebContentProcessDidTerminate(mockWebView);
 
         final WebResourceError error =
@@ -1017,12 +1082,19 @@
           (WidgetTester tester) async {
         await buildWidget(tester, hasNavigationDelegate: true);
 
-        final dynamic decidePolicyForNavigationAction = verify(
-                    mockNavigationDelegate
-                        .setDecidePolicyForNavigationAction(captureAny))
-                .captured
-                .single
-            as Future<WKNavigationActionPolicy> Function(
+        final dynamic decidePolicyForNavigationAction =
+            verify(mockWebViewWidgetProxy.createNavigationDelegate(
+          didFinishNavigation: anyNamed('didFinishNavigation'),
+          didStartProvisionalNavigation:
+              anyNamed('didStartProvisionalNavigation'),
+          decidePolicyForNavigationAction:
+              captureAnyNamed('decidePolicyForNavigationAction'),
+          didFailNavigation: anyNamed('didFailNavigation'),
+          didFailProvisionalNavigation:
+              anyNamed('didFailProvisionalNavigation'),
+          webViewWebContentProcessDidTerminate:
+              anyNamed('webViewWebContentProcessDidTerminate'),
+        )).captured.single as Future<WKNavigationActionPolicy> Function(
                 WKWebView, WKNavigationAction);
 
         when(mockCallbacksHandler.onNavigationRequest(
@@ -1049,13 +1121,6 @@
 
       testWidgets('onProgress', (WidgetTester tester) async {
         await buildWidget(tester, hasProgressTracking: true);
-        final dynamic observeValue =
-            verify(mockWebView.setObserveValue(captureAny)).captured.single
-                as void Function(
-          String keyPath,
-          NSObject object,
-          Map<NSKeyValueChangeKey, Object?> change,
-        );
 
         verify(mockWebView.addObserver(
           mockWebView,
@@ -1065,6 +1130,16 @@
           },
         ));
 
+        final dynamic observeValue = verify(
+                mockWebViewWidgetProxy.createWebView(any,
+                    observeValue: captureAnyNamed('observeValue')))
+            .captured
+            .single as void Function(
+          String keyPath,
+          NSObject object,
+          Map<NSKeyValueChangeKey, Object?> change,
+        );
+
         observeValue(
           'estimatedProgress',
           mockWebView,
@@ -1077,23 +1152,23 @@
 
     group('JavascriptChannelRegistry', () {
       testWidgets('onJavascriptChannelMessage', (WidgetTester tester) async {
-        when(mockWebViewWidgetProxy.createScriptMessageHandler()).thenReturn(
+        when(
+          mockWebViewWidgetProxy.createScriptMessageHandler(
+            didReceiveScriptMessage: anyNamed('didReceiveScriptMessage'),
+          ),
+        ).thenReturn(
           MockWKScriptMessageHandler(),
         );
 
         await buildWidget(tester);
         await testController.addJavascriptChannels(<String>{'hello'});
 
-        final MockWKScriptMessageHandler messageHandler = verify(
-                mockUserContentController.addScriptMessageHandler(
-                    captureAny, 'hello'))
+        final dynamic didReceiveScriptMessage = verify(
+                mockWebViewWidgetProxy.createScriptMessageHandler(
+                    didReceiveScriptMessage:
+                        captureAnyNamed('didReceiveScriptMessage')))
             .captured
-            .single as MockWKScriptMessageHandler;
-
-        final dynamic didReceiveScriptMessage =
-            verify(messageHandler.setDidReceiveScriptMessage(captureAny))
-                .captured
-                .single as void Function(
+            .single as void Function(
           WKUserContentController userContentController,
           WKScriptMessage message,
         );
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.mocks.dart
index f2a9876..728c526 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.mocks.dart
+++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.mocks.dart
@@ -1,4 +1,4 @@
-// Mocks generated by Mockito 5.1.0 from annotations
+// Mocks generated by Mockito 5.2.0 from annotations
 // in webview_flutter_wkwebview/example/ios/.symlinks/plugins/webview_flutter_wkwebview/test/src/web_kit_webview_widget_test.dart.
 // Do not manually edit this file.
 
@@ -36,31 +36,31 @@
 
 class _FakeCopyable_1 extends _i1.Fake implements _i3.Copyable {}
 
-class _FakeWKWebViewConfiguration_2 extends _i1.Fake
+class _FakeWKNavigationDelegate_2 extends _i1.Fake
+    implements _i4.WKNavigationDelegate {}
+
+class _FakeWKWebViewConfiguration_3 extends _i1.Fake
     implements _i4.WKWebViewConfiguration {}
 
-class _FakeUIScrollView_3 extends _i1.Fake implements _i5.UIScrollView {}
+class _FakeUIScrollView_4 extends _i1.Fake implements _i5.UIScrollView {}
 
-class _FakeWKUserContentController_4 extends _i1.Fake
+class _FakeWKUserContentController_5 extends _i1.Fake
     implements _i4.WKUserContentController {}
 
-class _FakeWKPreferences_5 extends _i1.Fake implements _i4.WKPreferences {}
+class _FakeWKPreferences_6 extends _i1.Fake implements _i4.WKPreferences {}
 
-class _FakeWKWebsiteDataStore_6 extends _i1.Fake
+class _FakeWKWebsiteDataStore_7 extends _i1.Fake
     implements _i4.WKWebsiteDataStore {}
 
-class _FakeWKHttpCookieStore_7 extends _i1.Fake
+class _FakeWKHttpCookieStore_8 extends _i1.Fake
     implements _i4.WKHttpCookieStore {}
 
-class _FakeWKWebView_8 extends _i1.Fake implements _i4.WKWebView {}
+class _FakeWKWebView_9 extends _i1.Fake implements _i4.WKWebView {}
 
-class _FakeWKScriptMessageHandler_9 extends _i1.Fake
+class _FakeWKScriptMessageHandler_10 extends _i1.Fake
     implements _i4.WKScriptMessageHandler {}
 
-class _FakeWKUIDelegate_10 extends _i1.Fake implements _i4.WKUIDelegate {}
-
-class _FakeWKNavigationDelegate_11 extends _i1.Fake
-    implements _i4.WKNavigationDelegate {}
+class _FakeWKUIDelegate_11 extends _i1.Fake implements _i4.WKUIDelegate {}
 
 /// A class which mocks [UIScrollView].
 ///
@@ -110,14 +110,6 @@
           returnValue: Future<void>.value(),
           returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
   @override
-  _i6.Future<void> setObserveValue(
-          void Function(
-                  String, _i8.NSObject, Map<_i8.NSKeyValueChangeKey, Object?>)?
-              observeValue) =>
-      (super.noSuchMethod(Invocation.method(#setObserveValue, [observeValue]),
-          returnValue: Future<void>.value(),
-          returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
-  @override
   _i3.Copyable copy() => (super.noSuchMethod(Invocation.method(#copy, []),
       returnValue: _FakeCopyable_1()) as _i3.Copyable);
 }
@@ -133,51 +125,9 @@
   }
 
   @override
-  _i6.Future<void> setDidStartProvisionalNavigation(
-          void Function(_i4.WKWebView, String?)?
-              didStartProvisionalNavigation) =>
-      (super.noSuchMethod(
-          Invocation.method(#setDidStartProvisionalNavigation,
-              [didStartProvisionalNavigation]),
-          returnValue: Future<void>.value(),
-          returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
-  @override
-  _i6.Future<void> setDecidePolicyForNavigationAction(
-          _i6.Future<_i4.WKNavigationActionPolicy> Function(
-                  _i4.WKWebView, _i4.WKNavigationAction)?
-              decidePolicyForNavigationAction) =>
-      (super.noSuchMethod(
-          Invocation.method(#setDecidePolicyForNavigationAction,
-              [decidePolicyForNavigationAction]),
-          returnValue: Future<void>.value(),
-          returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
-  @override
-  _i6.Future<void> setDidFailNavigation(
-          void Function(_i4.WKWebView, _i8.NSError)? didFailNavigation) =>
-      (super.noSuchMethod(
-          Invocation.method(#setDidFailNavigation, [didFailNavigation]),
-          returnValue: Future<void>.value(),
-          returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
-  @override
-  _i6.Future<void> setDidFailProvisionalNavigation(
-          void Function(_i4.WKWebView, _i8.NSError)?
-              didFailProvisionalNavigation) =>
-      (super.noSuchMethod(
-          Invocation.method(
-              #setDidFailProvisionalNavigation, [didFailProvisionalNavigation]),
-          returnValue: Future<void>.value(),
-          returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
-  @override
-  _i6.Future<void> setWebViewWebContentProcessDidTerminate(
-          void Function(_i4.WKWebView)? webViewWebContentProcessDidTerminate) =>
-      (super.noSuchMethod(
-          Invocation.method(#setWebViewWebContentProcessDidTerminate,
-              [webViewWebContentProcessDidTerminate]),
-          returnValue: Future<void>.value(),
-          returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
-  @override
-  _i3.Copyable copy() => (super.noSuchMethod(Invocation.method(#copy, []),
-      returnValue: _FakeCopyable_1()) as _i3.Copyable);
+  _i4.WKNavigationDelegate copy() => (super.noSuchMethod(
+      Invocation.method(#copy, []),
+      returnValue: _FakeWKNavigationDelegate_2()) as _i4.WKNavigationDelegate);
   @override
   _i6.Future<void> addObserver(_i8.NSObject? observer,
           {String? keyPath, Set<_i8.NSKeyValueObservingOptions>? options}) =>
@@ -192,14 +142,6 @@
           Invocation.method(#removeObserver, [observer], {#keyPath: keyPath}),
           returnValue: Future<void>.value(),
           returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
-  @override
-  _i6.Future<void> setObserveValue(
-          void Function(
-                  String, _i8.NSObject, Map<_i8.NSKeyValueChangeKey, Object?>)?
-              observeValue) =>
-      (super.noSuchMethod(Invocation.method(#setObserveValue, [observeValue]),
-          returnValue: Future<void>.value(),
-          returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
 }
 
 /// A class which mocks [WKPreferences].
@@ -230,14 +172,6 @@
           returnValue: Future<void>.value(),
           returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
   @override
-  _i6.Future<void> setObserveValue(
-          void Function(
-                  String, _i8.NSObject, Map<_i8.NSKeyValueChangeKey, Object?>)?
-              observeValue) =>
-      (super.noSuchMethod(Invocation.method(#setObserveValue, [observeValue]),
-          returnValue: Future<void>.value(),
-          returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
-  @override
   _i3.Copyable copy() => (super.noSuchMethod(Invocation.method(#copy, []),
       returnValue: _FakeCopyable_1()) as _i3.Copyable);
 }
@@ -252,14 +186,12 @@
   }
 
   @override
-  _i6.Future<void> setDidReceiveScriptMessage(
-          void Function(_i4.WKUserContentController, _i4.WKScriptMessage)?
-              didReceiveScriptMessage) =>
-      (super.noSuchMethod(
-          Invocation.method(
-              #setDidReceiveScriptMessage, [didReceiveScriptMessage]),
-          returnValue: Future<void>.value(),
-          returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
+  void Function(_i4.WKUserContentController, _i4.WKScriptMessage)
+      get didReceiveScriptMessage =>
+          (super.noSuchMethod(Invocation.getter(#didReceiveScriptMessage),
+              returnValue: (_i4.WKUserContentController userContentController,
+                  _i4.WKScriptMessage message) {}) as void Function(
+              _i4.WKUserContentController, _i4.WKScriptMessage));
   @override
   _i6.Future<void> addObserver(_i8.NSObject? observer,
           {String? keyPath, Set<_i8.NSKeyValueObservingOptions>? options}) =>
@@ -275,14 +207,6 @@
           returnValue: Future<void>.value(),
           returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
   @override
-  _i6.Future<void> setObserveValue(
-          void Function(
-                  String, _i8.NSObject, Map<_i8.NSKeyValueChangeKey, Object?>)?
-              observeValue) =>
-      (super.noSuchMethod(Invocation.method(#setObserveValue, [observeValue]),
-          returnValue: Future<void>.value(),
-          returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
-  @override
   _i3.Copyable copy() => (super.noSuchMethod(Invocation.method(#copy, []),
       returnValue: _FakeCopyable_1()) as _i3.Copyable);
 }
@@ -298,12 +222,12 @@
   @override
   _i4.WKWebViewConfiguration get configuration =>
       (super.noSuchMethod(Invocation.getter(#configuration),
-              returnValue: _FakeWKWebViewConfiguration_2())
+              returnValue: _FakeWKWebViewConfiguration_3())
           as _i4.WKWebViewConfiguration);
   @override
   _i5.UIScrollView get scrollView =>
       (super.noSuchMethod(Invocation.getter(#scrollView),
-          returnValue: _FakeUIScrollView_3()) as _i5.UIScrollView);
+          returnValue: _FakeUIScrollView_4()) as _i5.UIScrollView);
   @override
   _i6.Future<void> setUIDelegate(_i4.WKUIDelegate? delegate) =>
       (super.noSuchMethod(Invocation.method(#setUIDelegate, [delegate]),
@@ -412,14 +336,6 @@
           returnValue: Future<void>.value(),
           returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
   @override
-  _i6.Future<void> setObserveValue(
-          void Function(
-                  String, _i8.NSObject, Map<_i8.NSKeyValueChangeKey, Object?>)?
-              observeValue) =>
-      (super.noSuchMethod(Invocation.method(#setObserveValue, [observeValue]),
-          returnValue: Future<void>.value(),
-          returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
-  @override
   _i3.Copyable copy() => (super.noSuchMethod(Invocation.method(#copy, []),
       returnValue: _FakeCopyable_1()) as _i3.Copyable);
 }
@@ -436,16 +352,16 @@
   @override
   _i4.WKUserContentController get userContentController =>
       (super.noSuchMethod(Invocation.getter(#userContentController),
-              returnValue: _FakeWKUserContentController_4())
+              returnValue: _FakeWKUserContentController_5())
           as _i4.WKUserContentController);
   @override
   _i4.WKPreferences get preferences =>
       (super.noSuchMethod(Invocation.getter(#preferences),
-          returnValue: _FakeWKPreferences_5()) as _i4.WKPreferences);
+          returnValue: _FakeWKPreferences_6()) as _i4.WKPreferences);
   @override
   _i4.WKWebsiteDataStore get websiteDataStore =>
       (super.noSuchMethod(Invocation.getter(#websiteDataStore),
-          returnValue: _FakeWKWebsiteDataStore_6()) as _i4.WKWebsiteDataStore);
+          returnValue: _FakeWKWebsiteDataStore_7()) as _i4.WKWebsiteDataStore);
   @override
   _i6.Future<void> setAllowsInlineMediaPlayback(bool? allow) => (super
       .noSuchMethod(Invocation.method(#setAllowsInlineMediaPlayback, [allow]),
@@ -474,14 +390,6 @@
           returnValue: Future<void>.value(),
           returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
   @override
-  _i6.Future<void> setObserveValue(
-          void Function(
-                  String, _i8.NSObject, Map<_i8.NSKeyValueChangeKey, Object?>)?
-              observeValue) =>
-      (super.noSuchMethod(Invocation.method(#setObserveValue, [observeValue]),
-          returnValue: Future<void>.value(),
-          returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
-  @override
   _i3.Copyable copy() => (super.noSuchMethod(Invocation.method(#copy, []),
       returnValue: _FakeCopyable_1()) as _i3.Copyable);
 }
@@ -498,7 +406,7 @@
   @override
   _i4.WKHttpCookieStore get httpCookieStore =>
       (super.noSuchMethod(Invocation.getter(#httpCookieStore),
-          returnValue: _FakeWKHttpCookieStore_7()) as _i4.WKHttpCookieStore);
+          returnValue: _FakeWKHttpCookieStore_8()) as _i4.WKHttpCookieStore);
   @override
   _i6.Future<bool> removeDataOfTypes(
           Set<_i4.WKWebsiteDataType>? dataTypes, DateTime? since) =>
@@ -520,14 +428,6 @@
           returnValue: Future<void>.value(),
           returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
   @override
-  _i6.Future<void> setObserveValue(
-          void Function(
-                  String, _i8.NSObject, Map<_i8.NSKeyValueChangeKey, Object?>)?
-              observeValue) =>
-      (super.noSuchMethod(Invocation.method(#setObserveValue, [observeValue]),
-          returnValue: Future<void>.value(),
-          returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
-  @override
   _i3.Copyable copy() => (super.noSuchMethod(Invocation.method(#copy, []),
       returnValue: _FakeCopyable_1()) as _i3.Copyable);
 }
@@ -541,14 +441,6 @@
   }
 
   @override
-  _i6.Future<void> setOnCreateWebView(
-          void Function(_i4.WKWebViewConfiguration, _i4.WKNavigationAction)?
-              onCreateWebView) =>
-      (super.noSuchMethod(
-          Invocation.method(#setOnCreateWebView, [onCreateWebView]),
-          returnValue: Future<void>.value(),
-          returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
-  @override
   _i6.Future<void> addObserver(_i8.NSObject? observer,
           {String? keyPath, Set<_i8.NSKeyValueObservingOptions>? options}) =>
       (super.noSuchMethod(
@@ -563,14 +455,6 @@
           returnValue: Future<void>.value(),
           returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
   @override
-  _i6.Future<void> setObserveValue(
-          void Function(
-                  String, _i8.NSObject, Map<_i8.NSKeyValueChangeKey, Object?>)?
-              observeValue) =>
-      (super.noSuchMethod(Invocation.method(#setObserveValue, [observeValue]),
-          returnValue: Future<void>.value(),
-          returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
-  @override
   _i3.Copyable copy() => (super.noSuchMethod(Invocation.method(#copy, []),
       returnValue: _FakeCopyable_1()) as _i3.Copyable);
 }
@@ -626,14 +510,6 @@
           returnValue: Future<void>.value(),
           returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
   @override
-  _i6.Future<void> setObserveValue(
-          void Function(
-                  String, _i8.NSObject, Map<_i8.NSKeyValueChangeKey, Object?>)?
-              observeValue) =>
-      (super.noSuchMethod(Invocation.method(#setObserveValue, [observeValue]),
-          returnValue: Future<void>.value(),
-          returnValueForMissingStub: Future<void>.value()) as _i6.Future<void>);
-  @override
   _i3.Copyable copy() => (super.noSuchMethod(Invocation.method(#copy, []),
       returnValue: _FakeCopyable_1()) as _i3.Copyable);
 }
@@ -707,24 +583,54 @@
   }
 
   @override
-  _i4.WKWebView createWebView(_i4.WKWebViewConfiguration? configuration) =>
-      (super.noSuchMethod(Invocation.method(#createWebView, [configuration]),
-          returnValue: _FakeWKWebView_8()) as _i4.WKWebView);
+  _i4.WKWebView createWebView(_i4.WKWebViewConfiguration? configuration,
+          {void Function(
+                  String, _i8.NSObject, Map<_i8.NSKeyValueChangeKey, Object?>)?
+              observeValue}) =>
+      (super.noSuchMethod(
+          Invocation.method(
+              #createWebView, [configuration], {#observeValue: observeValue}),
+          returnValue: _FakeWKWebView_9()) as _i4.WKWebView);
   @override
-  _i4.WKScriptMessageHandler createScriptMessageHandler() =>
-      (super.noSuchMethod(Invocation.method(#createScriptMessageHandler, []),
-              returnValue: _FakeWKScriptMessageHandler_9())
+  _i4.WKScriptMessageHandler createScriptMessageHandler(
+          {void Function(_i4.WKUserContentController, _i4.WKScriptMessage)?
+              didReceiveScriptMessage}) =>
+      (super.noSuchMethod(
+              Invocation.method(#createScriptMessageHandler, [],
+                  {#didReceiveScriptMessage: didReceiveScriptMessage}),
+              returnValue: _FakeWKScriptMessageHandler_10())
           as _i4.WKScriptMessageHandler);
   @override
-  _i4.WKUIDelegate createUIDelgate() =>
-      (super.noSuchMethod(Invocation.method(#createUIDelgate, []),
-          returnValue: _FakeWKUIDelegate_10()) as _i4.WKUIDelegate);
+  _i4.WKUIDelegate createUIDelgate(
+          {void Function(_i4.WKWebViewConfiguration, _i4.WKNavigationAction)?
+              onCreateWebView}) =>
+      (super.noSuchMethod(
+          Invocation.method(
+              #createUIDelgate, [], {#onCreateWebView: onCreateWebView}),
+          returnValue: _FakeWKUIDelegate_11()) as _i4.WKUIDelegate);
   @override
   _i4.WKNavigationDelegate createNavigationDelegate(
-          {void Function(_i4.WKWebView, String?)? didFinishNavigation}) =>
+          {void Function(_i4.WKWebView, String?)? didFinishNavigation,
+          void Function(_i4.WKWebView, String?)? didStartProvisionalNavigation,
+          _i6.Future<_i4.WKNavigationActionPolicy> Function(
+                  _i4.WKWebView, _i4.WKNavigationAction)?
+              decidePolicyForNavigationAction,
+          void Function(_i4.WKWebView, _i8.NSError)? didFailNavigation,
+          void Function(_i4.WKWebView, _i8.NSError)?
+              didFailProvisionalNavigation,
+          void Function(_i4.WKWebView)?
+              webViewWebContentProcessDidTerminate}) =>
       (super.noSuchMethod(
-              Invocation.method(#createNavigationDelegate, [],
-                  {#didFinishNavigation: didFinishNavigation}),
-              returnValue: _FakeWKNavigationDelegate_11())
+              Invocation.method(#createNavigationDelegate, [], {
+                #didFinishNavigation: didFinishNavigation,
+                #didStartProvisionalNavigation: didStartProvisionalNavigation,
+                #decidePolicyForNavigationAction:
+                    decidePolicyForNavigationAction,
+                #didFailNavigation: didFailNavigation,
+                #didFailProvisionalNavigation: didFailProvisionalNavigation,
+                #webViewWebContentProcessDidTerminate:
+                    webViewWebContentProcessDidTerminate
+              }),
+              returnValue: _FakeWKNavigationDelegate_2())
           as _i4.WKNavigationDelegate);
 }