[webview_flutter] Implementation of the app facing NavigationDelegate for v4 (#6368)

diff --git a/packages/webview_flutter/webview_flutter/lib/src/v4/src/navigation_delegate.dart b/packages/webview_flutter/webview_flutter/lib/src/v4/src/navigation_delegate.dart
new file mode 100644
index 0000000..41c0ca2
--- /dev/null
+++ b/packages/webview_flutter/webview_flutter/lib/src/v4/src/navigation_delegate.dart
@@ -0,0 +1,104 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'dart:async';
+
+import 'package:webview_flutter_platform_interface/v4/webview_flutter_platform_interface.dart';
+
+import 'webview_controller.dart';
+
+/// Callbacks for accepting or rejecting navigation changes, and for tracking
+/// the progress of navigation requests.
+///
+/// See [WebViewController.setNavigationDelegate].
+class NavigationDelegate {
+  /// Constructs a [NavigationDelegate].
+  NavigationDelegate({
+    FutureOr<NavigationDecision> Function(NavigationRequest request)?
+        onNavigationRequest,
+    void Function(String url)? onPageStarted,
+    void Function(String url)? onPageFinished,
+    void Function(int progress)? onProgress,
+    void Function(WebResourceError error)? onWebResourceError,
+  }) : this.fromPlatformCreationParams(
+          const PlatformNavigationDelegateCreationParams(),
+          onNavigationRequest: onNavigationRequest,
+          onPageStarted: onPageStarted,
+          onPageFinished: onPageFinished,
+          onProgress: onProgress,
+          onWebResourceError: onWebResourceError,
+        );
+
+  /// Constructs a [NavigationDelegate] from creation params for a specific
+  /// platform.
+  NavigationDelegate.fromPlatformCreationParams(
+    PlatformNavigationDelegateCreationParams params, {
+    FutureOr<NavigationDecision> Function(NavigationRequest request)?
+        onNavigationRequest,
+    void Function(String url)? onPageStarted,
+    void Function(String url)? onPageFinished,
+    void Function(int progress)? onProgress,
+    void Function(WebResourceError error)? onWebResourceError,
+  }) : this.fromPlatform(
+          PlatformNavigationDelegate(params),
+          onNavigationRequest: onNavigationRequest,
+          onPageStarted: onPageStarted,
+          onPageFinished: onPageFinished,
+          onProgress: onProgress,
+          onWebResourceError: onWebResourceError,
+        );
+
+  /// Constructs a [NavigationDelegate] from a specific platform implementation.
+  NavigationDelegate.fromPlatform(
+    this.platform, {
+    this.onNavigationRequest,
+    this.onPageStarted,
+    this.onPageFinished,
+    this.onProgress,
+    this.onWebResourceError,
+  }) {
+    if (onNavigationRequest != null) {
+      platform.setOnNavigationRequest(onNavigationRequest!);
+    }
+    if (onPageStarted != null) {
+      platform.setOnPageStarted(onPageStarted!);
+    }
+    if (onPageFinished != null) {
+      platform.setOnPageFinished(onPageFinished!);
+    }
+    if (onProgress != null) {
+      platform.setOnProgress(onProgress!);
+    }
+    if (onWebResourceError != null) {
+      platform.setOnWebResourceError(onWebResourceError!);
+    }
+  }
+
+  /// Implementation of [PlatformNavigationDelegate] for the current platform.
+  final PlatformNavigationDelegate platform;
+
+  /// Invoked when a decision for a navigation request is pending.
+  ///
+  /// When a navigation is initiated by the WebView (e.g when a user clicks a
+  /// link) this delegate is called and has to decide how to proceed with the
+  /// navigation.
+  ///
+  /// *Important*: Some platforms may also trigger this callback from calls to
+  /// [WebViewController.loadRequest].
+  ///
+  /// See [NavigationDecision].
+  final NavigationRequestCallback? onNavigationRequest;
+
+  /// Invoked when a page has started loading.
+  final PageEventCallback? onPageStarted;
+
+  /// Invoked when a page has finished loading.
+  final PageEventCallback? onPageFinished;
+
+  /// Invoked when a page is loading to report the progress.
+  final ProgressCallback? onProgress;
+
+  /// Invoked when a resource loading error occurred.
+  final WebResourceErrorCallback? onWebResourceError;
+}
diff --git a/packages/webview_flutter/webview_flutter/lib/src/v4/src/webview_controller.dart b/packages/webview_flutter/webview_flutter/lib/src/v4/src/webview_controller.dart
index bd03b24..5736770 100644
--- a/packages/webview_flutter/webview_flutter/lib/src/v4/src/webview_controller.dart
+++ b/packages/webview_flutter/webview_flutter/lib/src/v4/src/webview_controller.dart
@@ -3,7 +3,6 @@
 // found in the LICENSE file.
 
 import 'dart:math';
-
 // TODO(a14n): remove this import once Flutter 3.1 or later reaches stable (including flutter/flutter#104231)
 // ignore: unnecessary_import
 import 'dart:typed_data';
@@ -11,6 +10,8 @@
 import 'package:flutter/material.dart';
 import 'package:webview_flutter_platform_interface/v4/webview_flutter_platform_interface.dart';
 
+import 'navigation_delegate.dart';
+
 /// Controls a WebView provided by the host platform.
 ///
 /// Pass this to a [WebViewWidget] to display the WebView.
@@ -125,6 +126,12 @@
     return platform.reload();
   }
 
+  /// Sets the [NavigationDelegate] containing the callback methods that are
+  /// called during navigation events.
+  Future<void> setNavigationDelegate(NavigationDelegate delegate) {
+    return platform.setPlatformNavigationDelegate(delegate.platform);
+  }
+
   /// Clears all caches used by the WebView.
   ///
   /// The following caches are cleared:
diff --git a/packages/webview_flutter/webview_flutter/lib/src/v4/src/webview_widget.dart b/packages/webview_flutter/webview_flutter/lib/src/v4/src/webview_widget.dart
index 06e4f78..4c544dc 100644
--- a/packages/webview_flutter/webview_flutter/lib/src/v4/src/webview_widget.dart
+++ b/packages/webview_flutter/webview_flutter/lib/src/v4/src/webview_widget.dart
@@ -35,8 +35,7 @@
   }) : this.fromPlatform(key: key, platform: PlatformWebViewWidget(params));
 
   /// Constructs a [WebViewWidget] from a specific platform implementation.
-  WebViewWidget.fromPlatform({Key? key, required this.platform})
-      : super(key: key);
+  WebViewWidget.fromPlatform({super.key, required this.platform});
 
   /// Implementation of [PlatformWebViewWidget] for the current platform.
   final PlatformWebViewWidget platform;
diff --git a/packages/webview_flutter/webview_flutter/lib/src/v4/webview_flutter.dart b/packages/webview_flutter/webview_flutter/lib/src/v4/webview_flutter.dart
index f4a0b20..68773ee 100644
--- a/packages/webview_flutter/webview_flutter/lib/src/v4/webview_flutter.dart
+++ b/packages/webview_flutter/webview_flutter/lib/src/v4/webview_flutter.dart
@@ -5,8 +5,18 @@
 library webview_flutter;
 
 export 'package:webview_flutter_platform_interface/v4/webview_flutter_platform_interface.dart'
-    show JavaScriptMessage, LoadRequestMethod, WebViewCookie;
+    show
+        JavaScriptMessage,
+        LoadRequestMethod,
+        NavigationDecision,
+        NavigationRequestCallback,
+        PageEventCallback,
+        ProgressCallback,
+        WebResourceError,
+        WebResourceErrorCallback,
+        WebViewCookie;
 
+export 'src/navigation_delegate.dart';
 export 'src/webview_controller.dart';
 export 'src/webview_cookie_manager.dart';
 export 'src/webview_widget.dart';
diff --git a/packages/webview_flutter/webview_flutter/lib/src/webview.dart b/packages/webview_flutter/webview_flutter/lib/src/webview.dart
index 697eb48..5e6e79e 100644
--- a/packages/webview_flutter/webview_flutter/lib/src/webview.dart
+++ b/packages/webview_flutter/webview_flutter/lib/src/webview.dart
@@ -76,7 +76,7 @@
   ///
   /// The `javascriptMode` and `autoMediaPlaybackPolicy` parameters must not be null.
   const WebView({
-    Key? key,
+    super.key,
     this.onWebViewCreated,
     this.initialUrl,
     this.initialCookies = const <WebViewCookie>[],
@@ -98,8 +98,7 @@
     this.backgroundColor,
   })  : assert(javascriptMode != null),
         assert(initialMediaPlaybackPolicy != null),
-        assert(allowsInlineMediaPlayback != null),
-        super(key: key);
+        assert(allowsInlineMediaPlayback != null);
 
   static WebViewPlatform? _platform;
 
diff --git a/packages/webview_flutter/webview_flutter/pubspec.yaml b/packages/webview_flutter/webview_flutter/pubspec.yaml
index a02b032..d6197da 100644
--- a/packages/webview_flutter/webview_flutter/pubspec.yaml
+++ b/packages/webview_flutter/webview_flutter/pubspec.yaml
@@ -3,10 +3,11 @@
 repository: https://github.com/flutter/plugins/tree/main/packages/webview_flutter/webview_flutter
 issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22
 version: 3.0.4
+publish_to: none
 
 environment:
-  sdk: ">=2.14.0 <3.0.0"
-  flutter: ">=2.10.0"
+  sdk: ">=2.17.0 <3.0.0"
+  flutter: ">=3.0.0"
 
 flutter:
   plugin:
@@ -19,9 +20,12 @@
 dependencies:
   flutter:
     sdk: flutter
-  webview_flutter_android: ^2.8.0
-  webview_flutter_platform_interface: ^1.9.3
-  webview_flutter_wkwebview: ^2.7.0
+  webview_flutter_android:
+    path: ../webview_flutter_android
+  webview_flutter_platform_interface:
+    path: ../webview_flutter_platform_interface
+  webview_flutter_wkwebview:
+    path: ../webview_flutter_wkwebview
 
 dev_dependencies:
   build_runner: ^2.1.5
diff --git a/packages/webview_flutter/webview_flutter/test/v4/navigation_delegate_test.dart b/packages/webview_flutter/webview_flutter/test/v4/navigation_delegate_test.dart
new file mode 100644
index 0000000..6cd0861
--- /dev/null
+++ b/packages/webview_flutter/webview_flutter/test/v4/navigation_delegate_test.dart
@@ -0,0 +1,91 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'package:flutter_test/flutter_test.dart';
+import 'package:mockito/annotations.dart';
+import 'package:mockito/mockito.dart';
+import 'package:plugin_platform_interface/plugin_platform_interface.dart';
+import 'package:webview_flutter/src/v4/webview_flutter.dart';
+import 'package:webview_flutter_platform_interface/v4/webview_flutter_platform_interface.dart';
+
+import 'navigation_delegate_test.mocks.dart';
+
+@GenerateMocks(<Type>[WebViewPlatform, PlatformNavigationDelegate])
+void main() {
+  group('NavigationDelegate', () {
+    test('onNavigationRequest', () async {
+      WebViewPlatform.instance = TestWebViewPlatform();
+
+      NavigationDecision onNavigationRequest(NavigationRequest request) {
+        return NavigationDecision.navigate;
+      }
+
+      final NavigationDelegate delegate = NavigationDelegate(
+        onNavigationRequest: onNavigationRequest,
+      );
+
+      verify(delegate.platform.setOnNavigationRequest(onNavigationRequest));
+    });
+
+    test('onPageStarted', () async {
+      WebViewPlatform.instance = TestWebViewPlatform();
+
+      void onPageStarted(String url) {}
+
+      final NavigationDelegate delegate = NavigationDelegate(
+        onPageStarted: onPageStarted,
+      );
+
+      verify(delegate.platform.setOnPageStarted(onPageStarted));
+    });
+
+    test('onPageFinished', () async {
+      WebViewPlatform.instance = TestWebViewPlatform();
+
+      void onPageFinished(String url) {}
+
+      final NavigationDelegate delegate = NavigationDelegate(
+        onPageFinished: onPageFinished,
+      );
+
+      verify(delegate.platform.setOnPageFinished(onPageFinished));
+    });
+
+    test('onProgress', () async {
+      WebViewPlatform.instance = TestWebViewPlatform();
+
+      void onProgress(int progress) {}
+
+      final NavigationDelegate delegate = NavigationDelegate(
+        onProgress: onProgress,
+      );
+
+      verify(delegate.platform.setOnProgress(onProgress));
+    });
+
+    test('onWebResourceError', () async {
+      WebViewPlatform.instance = TestWebViewPlatform();
+
+      void onWebResourceError(WebResourceError error) {}
+
+      final NavigationDelegate delegate = NavigationDelegate(
+        onWebResourceError: onWebResourceError,
+      );
+
+      verify(delegate.platform.setOnWebResourceError(onWebResourceError));
+    });
+  });
+}
+
+class TestWebViewPlatform extends WebViewPlatform {
+  @override
+  PlatformNavigationDelegate createPlatformNavigationDelegate(
+    PlatformNavigationDelegateCreationParams params,
+  ) {
+    return TestMockPlatformNavigationDelegate();
+  }
+}
+
+class TestMockPlatformNavigationDelegate extends MockPlatformNavigationDelegate
+    with MockPlatformInterfaceMixin {}
diff --git a/packages/webview_flutter/webview_flutter/test/v4/navigation_delegate_test.mocks.dart b/packages/webview_flutter/webview_flutter/test/v4/navigation_delegate_test.mocks.dart
new file mode 100644
index 0000000..a08801c
--- /dev/null
+++ b/packages/webview_flutter/webview_flutter/test/v4/navigation_delegate_test.mocks.dart
@@ -0,0 +1,232 @@
+// Mocks generated by Mockito 5.3.1 from annotations
+// in webview_flutter/test/v4/navigation_delegate_test.dart.
+// Do not manually edit this file.
+
+// ignore_for_file: no_leading_underscores_for_library_prefixes
+import 'dart:async' as _i8;
+
+import 'package:mockito/mockito.dart' as _i1;
+import 'package:webview_flutter_platform_interface/v4/src/platform_navigation_delegate.dart'
+    as _i3;
+import 'package:webview_flutter_platform_interface/v4/src/platform_webview_controller.dart'
+    as _i4;
+import 'package:webview_flutter_platform_interface/v4/src/platform_webview_cookie_manager.dart'
+    as _i2;
+import 'package:webview_flutter_platform_interface/v4/src/platform_webview_widget.dart'
+    as _i5;
+import 'package:webview_flutter_platform_interface/v4/src/types/types.dart'
+    as _i6;
+import 'package:webview_flutter_platform_interface/v4/src/webview_platform.dart'
+    as _i7;
+
+// ignore_for_file: type=lint
+// ignore_for_file: avoid_redundant_argument_values
+// ignore_for_file: avoid_setters_without_getters
+// ignore_for_file: comment_references
+// ignore_for_file: implementation_imports
+// ignore_for_file: invalid_use_of_visible_for_testing_member
+// ignore_for_file: prefer_const_constructors
+// ignore_for_file: unnecessary_parenthesis
+// ignore_for_file: camel_case_types
+// ignore_for_file: subtype_of_sealed_class
+
+class _FakePlatformWebViewCookieManager_0 extends _i1.SmartFake
+    implements _i2.PlatformWebViewCookieManager {
+  _FakePlatformWebViewCookieManager_0(
+    Object parent,
+    Invocation parentInvocation,
+  ) : super(
+          parent,
+          parentInvocation,
+        );
+}
+
+class _FakePlatformNavigationDelegate_1 extends _i1.SmartFake
+    implements _i3.PlatformNavigationDelegate {
+  _FakePlatformNavigationDelegate_1(
+    Object parent,
+    Invocation parentInvocation,
+  ) : super(
+          parent,
+          parentInvocation,
+        );
+}
+
+class _FakePlatformWebViewController_2 extends _i1.SmartFake
+    implements _i4.PlatformWebViewController {
+  _FakePlatformWebViewController_2(
+    Object parent,
+    Invocation parentInvocation,
+  ) : super(
+          parent,
+          parentInvocation,
+        );
+}
+
+class _FakePlatformWebViewWidget_3 extends _i1.SmartFake
+    implements _i5.PlatformWebViewWidget {
+  _FakePlatformWebViewWidget_3(
+    Object parent,
+    Invocation parentInvocation,
+  ) : super(
+          parent,
+          parentInvocation,
+        );
+}
+
+class _FakePlatformNavigationDelegateCreationParams_4 extends _i1.SmartFake
+    implements _i6.PlatformNavigationDelegateCreationParams {
+  _FakePlatformNavigationDelegateCreationParams_4(
+    Object parent,
+    Invocation parentInvocation,
+  ) : super(
+          parent,
+          parentInvocation,
+        );
+}
+
+/// A class which mocks [WebViewPlatform].
+///
+/// See the documentation for Mockito's code generation for more information.
+class MockWebViewPlatform extends _i1.Mock implements _i7.WebViewPlatform {
+  MockWebViewPlatform() {
+    _i1.throwOnMissingStub(this);
+  }
+
+  @override
+  _i2.PlatformWebViewCookieManager createPlatformCookieManager(
+          _i6.PlatformWebViewCookieManagerCreationParams? params) =>
+      (super.noSuchMethod(
+        Invocation.method(
+          #createPlatformCookieManager,
+          [params],
+        ),
+        returnValue: _FakePlatformWebViewCookieManager_0(
+          this,
+          Invocation.method(
+            #createPlatformCookieManager,
+            [params],
+          ),
+        ),
+      ) as _i2.PlatformWebViewCookieManager);
+  @override
+  _i3.PlatformNavigationDelegate createPlatformNavigationDelegate(
+          _i6.PlatformNavigationDelegateCreationParams? params) =>
+      (super.noSuchMethod(
+        Invocation.method(
+          #createPlatformNavigationDelegate,
+          [params],
+        ),
+        returnValue: _FakePlatformNavigationDelegate_1(
+          this,
+          Invocation.method(
+            #createPlatformNavigationDelegate,
+            [params],
+          ),
+        ),
+      ) as _i3.PlatformNavigationDelegate);
+  @override
+  _i4.PlatformWebViewController createPlatformWebViewController(
+          _i6.PlatformWebViewControllerCreationParams? params) =>
+      (super.noSuchMethod(
+        Invocation.method(
+          #createPlatformWebViewController,
+          [params],
+        ),
+        returnValue: _FakePlatformWebViewController_2(
+          this,
+          Invocation.method(
+            #createPlatformWebViewController,
+            [params],
+          ),
+        ),
+      ) as _i4.PlatformWebViewController);
+  @override
+  _i5.PlatformWebViewWidget createPlatformWebViewWidget(
+          _i6.PlatformWebViewWidgetCreationParams? params) =>
+      (super.noSuchMethod(
+        Invocation.method(
+          #createPlatformWebViewWidget,
+          [params],
+        ),
+        returnValue: _FakePlatformWebViewWidget_3(
+          this,
+          Invocation.method(
+            #createPlatformWebViewWidget,
+            [params],
+          ),
+        ),
+      ) as _i5.PlatformWebViewWidget);
+}
+
+/// A class which mocks [PlatformNavigationDelegate].
+///
+/// See the documentation for Mockito's code generation for more information.
+class MockPlatformNavigationDelegate extends _i1.Mock
+    implements _i3.PlatformNavigationDelegate {
+  MockPlatformNavigationDelegate() {
+    _i1.throwOnMissingStub(this);
+  }
+
+  @override
+  _i6.PlatformNavigationDelegateCreationParams get params =>
+      (super.noSuchMethod(
+        Invocation.getter(#params),
+        returnValue: _FakePlatformNavigationDelegateCreationParams_4(
+          this,
+          Invocation.getter(#params),
+        ),
+      ) as _i6.PlatformNavigationDelegateCreationParams);
+  @override
+  _i8.Future<void> setOnNavigationRequest(
+          _i3.NavigationRequestCallback? onNavigationRequest) =>
+      (super.noSuchMethod(
+        Invocation.method(
+          #setOnNavigationRequest,
+          [onNavigationRequest],
+        ),
+        returnValue: _i8.Future<void>.value(),
+        returnValueForMissingStub: _i8.Future<void>.value(),
+      ) as _i8.Future<void>);
+  @override
+  _i8.Future<void> setOnPageStarted(_i3.PageEventCallback? onPageStarted) =>
+      (super.noSuchMethod(
+        Invocation.method(
+          #setOnPageStarted,
+          [onPageStarted],
+        ),
+        returnValue: _i8.Future<void>.value(),
+        returnValueForMissingStub: _i8.Future<void>.value(),
+      ) as _i8.Future<void>);
+  @override
+  _i8.Future<void> setOnPageFinished(_i3.PageEventCallback? onPageFinished) =>
+      (super.noSuchMethod(
+        Invocation.method(
+          #setOnPageFinished,
+          [onPageFinished],
+        ),
+        returnValue: _i8.Future<void>.value(),
+        returnValueForMissingStub: _i8.Future<void>.value(),
+      ) as _i8.Future<void>);
+  @override
+  _i8.Future<void> setOnProgress(_i3.ProgressCallback? onProgress) =>
+      (super.noSuchMethod(
+        Invocation.method(
+          #setOnProgress,
+          [onProgress],
+        ),
+        returnValue: _i8.Future<void>.value(),
+        returnValueForMissingStub: _i8.Future<void>.value(),
+      ) as _i8.Future<void>);
+  @override
+  _i8.Future<void> setOnWebResourceError(
+          _i3.WebResourceErrorCallback? onWebResourceError) =>
+      (super.noSuchMethod(
+        Invocation.method(
+          #setOnWebResourceError,
+          [onWebResourceError],
+        ),
+        returnValue: _i8.Future<void>.value(),
+        returnValueForMissingStub: _i8.Future<void>.value(),
+      ) as _i8.Future<void>);
+}
diff --git a/packages/webview_flutter/webview_flutter/test/v4/webview_controller_test.dart b/packages/webview_flutter/webview_flutter/test/v4/webview_controller_test.dart
index f767a2e..359a507 100644
--- a/packages/webview_flutter/webview_flutter/test/v4/webview_controller_test.dart
+++ b/packages/webview_flutter/webview_flutter/test/v4/webview_controller_test.dart
@@ -9,12 +9,12 @@
 import 'package:flutter_test/flutter_test.dart';
 import 'package:mockito/annotations.dart';
 import 'package:mockito/mockito.dart';
-import 'package:webview_flutter/src/v4/src/webview_controller.dart';
+import 'package:webview_flutter/src/v4/webview_flutter.dart';
 import 'package:webview_flutter_platform_interface/v4/webview_flutter_platform_interface.dart';
 
 import 'webview_controller_test.mocks.dart';
 
-@GenerateMocks(<Type>[PlatformWebViewController])
+@GenerateMocks(<Type>[PlatformWebViewController, PlatformNavigationDelegate])
 void main() {
   test('loadFile', () async {
     final MockPlatformWebViewController mockPlatformWebViewController =
@@ -350,4 +350,22 @@
     await webViewController.setUserAgent('userAgent');
     verify(mockPlatformWebViewController.setUserAgent('userAgent'));
   });
+
+  test('setNavigationDelegate', () async {
+    final MockPlatformWebViewController mockPlatformWebViewController =
+        MockPlatformWebViewController();
+    final WebViewController webViewController = WebViewController.fromPlatform(
+      mockPlatformWebViewController,
+    );
+
+    final MockPlatformNavigationDelegate mockPlatformNavigationDelegate =
+        MockPlatformNavigationDelegate();
+    final NavigationDelegate navigationDelegate =
+        NavigationDelegate.fromPlatform(mockPlatformNavigationDelegate);
+
+    await webViewController.setNavigationDelegate(navigationDelegate);
+    verify(mockPlatformWebViewController.setPlatformNavigationDelegate(
+      mockPlatformNavigationDelegate,
+    ));
+  });
 }
diff --git a/packages/webview_flutter/webview_flutter/test/v4/webview_controller_test.mocks.dart b/packages/webview_flutter/webview_flutter/test/v4/webview_controller_test.mocks.dart
index f0fb4b4..c39f790 100644
--- a/packages/webview_flutter/webview_flutter/test/v4/webview_controller_test.mocks.dart
+++ b/packages/webview_flutter/webview_flutter/test/v4/webview_controller_test.mocks.dart
@@ -1,4 +1,4 @@
-// Mocks generated by Mockito 5.3.0 from annotations
+// Mocks generated by Mockito 5.3.1 from annotations
 // in webview_flutter/test/v4/webview_controller_test.dart.
 // Do not manually edit this file.
 
@@ -29,14 +29,34 @@
 class _FakePlatformWebViewControllerCreationParams_0 extends _i1.SmartFake
     implements _i2.PlatformWebViewControllerCreationParams {
   _FakePlatformWebViewControllerCreationParams_0(
-      Object parent, Invocation parentInvocation)
-      : super(parent, parentInvocation);
+    Object parent,
+    Invocation parentInvocation,
+  ) : super(
+          parent,
+          parentInvocation,
+        );
 }
 
 class _FakePoint_1<T extends num> extends _i1.SmartFake
     implements _i3.Point<T> {
-  _FakePoint_1(Object parent, Invocation parentInvocation)
-      : super(parent, parentInvocation);
+  _FakePoint_1(
+    Object parent,
+    Invocation parentInvocation,
+  ) : super(
+          parent,
+          parentInvocation,
+        );
+}
+
+class _FakePlatformNavigationDelegateCreationParams_2 extends _i1.SmartFake
+    implements _i2.PlatformNavigationDelegateCreationParams {
+  _FakePlatformNavigationDelegateCreationParams_2(
+    Object parent,
+    Invocation parentInvocation,
+  ) : super(
+          parent,
+          parentInvocation,
+        );
 }
 
 /// A class which mocks [PlatformWebViewController].
@@ -49,155 +69,354 @@
   }
 
   @override
-  _i2.PlatformWebViewControllerCreationParams get params =>
-      (super.noSuchMethod(Invocation.getter(#params),
-              returnValue: _FakePlatformWebViewControllerCreationParams_0(
-                  this, Invocation.getter(#params)))
-          as _i2.PlatformWebViewControllerCreationParams);
+  _i2.PlatformWebViewControllerCreationParams get params => (super.noSuchMethod(
+        Invocation.getter(#params),
+        returnValue: _FakePlatformWebViewControllerCreationParams_0(
+          this,
+          Invocation.getter(#params),
+        ),
+      ) as _i2.PlatformWebViewControllerCreationParams);
   @override
   _i5.Future<void> loadFile(String? absoluteFilePath) => (super.noSuchMethod(
-      Invocation.method(#loadFile, [absoluteFilePath]),
-      returnValue: _i5.Future<void>.value(),
-      returnValueForMissingStub: _i5.Future<void>.value()) as _i5.Future<void>);
+        Invocation.method(
+          #loadFile,
+          [absoluteFilePath],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
   @override
   _i5.Future<void> loadFlutterAsset(String? key) => (super.noSuchMethod(
-      Invocation.method(#loadFlutterAsset, [key]),
-      returnValue: _i5.Future<void>.value(),
-      returnValueForMissingStub: _i5.Future<void>.value()) as _i5.Future<void>);
+        Invocation.method(
+          #loadFlutterAsset,
+          [key],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
   @override
-  _i5.Future<void> loadHtmlString(String? html, {String? baseUrl}) =>
+  _i5.Future<void> loadHtmlString(
+    String? html, {
+    String? baseUrl,
+  }) =>
       (super.noSuchMethod(
-              Invocation.method(#loadHtmlString, [html], {#baseUrl: baseUrl}),
-              returnValue: _i5.Future<void>.value(),
-              returnValueForMissingStub: _i5.Future<void>.value())
-          as _i5.Future<void>);
+        Invocation.method(
+          #loadHtmlString,
+          [html],
+          {#baseUrl: baseUrl},
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
   @override
   _i5.Future<void> loadRequest(_i2.LoadRequestParams? params) =>
-      (super.noSuchMethod(Invocation.method(#loadRequest, [params]),
-              returnValue: _i5.Future<void>.value(),
-              returnValueForMissingStub: _i5.Future<void>.value())
-          as _i5.Future<void>);
+      (super.noSuchMethod(
+        Invocation.method(
+          #loadRequest,
+          [params],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
   @override
-  _i5.Future<String?> currentUrl() =>
-      (super.noSuchMethod(Invocation.method(#currentUrl, []),
-          returnValue: _i5.Future<String?>.value()) as _i5.Future<String?>);
+  _i5.Future<String?> currentUrl() => (super.noSuchMethod(
+        Invocation.method(
+          #currentUrl,
+          [],
+        ),
+        returnValue: _i5.Future<String?>.value(),
+      ) as _i5.Future<String?>);
   @override
-  _i5.Future<bool> canGoBack() =>
-      (super.noSuchMethod(Invocation.method(#canGoBack, []),
-          returnValue: _i5.Future<bool>.value(false)) as _i5.Future<bool>);
+  _i5.Future<bool> canGoBack() => (super.noSuchMethod(
+        Invocation.method(
+          #canGoBack,
+          [],
+        ),
+        returnValue: _i5.Future<bool>.value(false),
+      ) as _i5.Future<bool>);
   @override
-  _i5.Future<bool> canGoForward() =>
-      (super.noSuchMethod(Invocation.method(#canGoForward, []),
-          returnValue: _i5.Future<bool>.value(false)) as _i5.Future<bool>);
+  _i5.Future<bool> canGoForward() => (super.noSuchMethod(
+        Invocation.method(
+          #canGoForward,
+          [],
+        ),
+        returnValue: _i5.Future<bool>.value(false),
+      ) as _i5.Future<bool>);
   @override
   _i5.Future<void> goBack() => (super.noSuchMethod(
-      Invocation.method(#goBack, []),
-      returnValue: _i5.Future<void>.value(),
-      returnValueForMissingStub: _i5.Future<void>.value()) as _i5.Future<void>);
+        Invocation.method(
+          #goBack,
+          [],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
   @override
   _i5.Future<void> goForward() => (super.noSuchMethod(
-      Invocation.method(#goForward, []),
-      returnValue: _i5.Future<void>.value(),
-      returnValueForMissingStub: _i5.Future<void>.value()) as _i5.Future<void>);
+        Invocation.method(
+          #goForward,
+          [],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
   @override
   _i5.Future<void> reload() => (super.noSuchMethod(
-      Invocation.method(#reload, []),
-      returnValue: _i5.Future<void>.value(),
-      returnValueForMissingStub: _i5.Future<void>.value()) as _i5.Future<void>);
+        Invocation.method(
+          #reload,
+          [],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
   @override
   _i5.Future<void> clearCache() => (super.noSuchMethod(
-      Invocation.method(#clearCache, []),
-      returnValue: _i5.Future<void>.value(),
-      returnValueForMissingStub: _i5.Future<void>.value()) as _i5.Future<void>);
+        Invocation.method(
+          #clearCache,
+          [],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
   @override
   _i5.Future<void> clearLocalStorage() => (super.noSuchMethod(
-      Invocation.method(#clearLocalStorage, []),
-      returnValue: _i5.Future<void>.value(),
-      returnValueForMissingStub: _i5.Future<void>.value()) as _i5.Future<void>);
+        Invocation.method(
+          #clearLocalStorage,
+          [],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
   @override
   _i5.Future<void> setPlatformNavigationDelegate(
           _i6.PlatformNavigationDelegate? handler) =>
       (super.noSuchMethod(
-              Invocation.method(#setPlatformNavigationDelegate, [handler]),
-              returnValue: _i5.Future<void>.value(),
-              returnValueForMissingStub: _i5.Future<void>.value())
-          as _i5.Future<void>);
+        Invocation.method(
+          #setPlatformNavigationDelegate,
+          [handler],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
   @override
   _i5.Future<void> runJavaScript(String? javaScript) => (super.noSuchMethod(
-      Invocation.method(#runJavaScript, [javaScript]),
-      returnValue: _i5.Future<void>.value(),
-      returnValueForMissingStub: _i5.Future<void>.value()) as _i5.Future<void>);
+        Invocation.method(
+          #runJavaScript,
+          [javaScript],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
   @override
   _i5.Future<String> runJavaScriptReturningResult(String? javaScript) =>
       (super.noSuchMethod(
-          Invocation.method(#runJavaScriptReturningResult, [javaScript]),
-          returnValue: _i5.Future<String>.value('')) as _i5.Future<String>);
+        Invocation.method(
+          #runJavaScriptReturningResult,
+          [javaScript],
+        ),
+        returnValue: _i5.Future<String>.value(''),
+      ) as _i5.Future<String>);
   @override
   _i5.Future<void> addJavaScriptChannel(
           _i4.JavaScriptChannelParams? javaScriptChannelParams) =>
       (super.noSuchMethod(
-          Invocation.method(#addJavaScriptChannel, [javaScriptChannelParams]),
-          returnValue: _i5.Future<void>.value(),
-          returnValueForMissingStub:
-              _i5.Future<void>.value()) as _i5.Future<void>);
+        Invocation.method(
+          #addJavaScriptChannel,
+          [javaScriptChannelParams],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
   @override
   _i5.Future<void> removeJavaScriptChannel(String? javaScriptChannelName) =>
       (super.noSuchMethod(
-          Invocation.method(#removeJavaScriptChannel, [javaScriptChannelName]),
-          returnValue: _i5.Future<void>.value(),
-          returnValueForMissingStub:
-              _i5.Future<void>.value()) as _i5.Future<void>);
+        Invocation.method(
+          #removeJavaScriptChannel,
+          [javaScriptChannelName],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
   @override
-  _i5.Future<String?> getTitle() =>
-      (super.noSuchMethod(Invocation.method(#getTitle, []),
-          returnValue: _i5.Future<String?>.value()) as _i5.Future<String?>);
+  _i5.Future<String?> getTitle() => (super.noSuchMethod(
+        Invocation.method(
+          #getTitle,
+          [],
+        ),
+        returnValue: _i5.Future<String?>.value(),
+      ) as _i5.Future<String?>);
   @override
-  _i5.Future<void> scrollTo(int? x, int? y) => (super.noSuchMethod(
-      Invocation.method(#scrollTo, [x, y]),
-      returnValue: _i5.Future<void>.value(),
-      returnValueForMissingStub: _i5.Future<void>.value()) as _i5.Future<void>);
+  _i5.Future<void> scrollTo(
+    int? x,
+    int? y,
+  ) =>
+      (super.noSuchMethod(
+        Invocation.method(
+          #scrollTo,
+          [
+            x,
+            y,
+          ],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
   @override
-  _i5.Future<void> scrollBy(int? x, int? y) => (super.noSuchMethod(
-      Invocation.method(#scrollBy, [x, y]),
-      returnValue: _i5.Future<void>.value(),
-      returnValueForMissingStub: _i5.Future<void>.value()) as _i5.Future<void>);
+  _i5.Future<void> scrollBy(
+    int? x,
+    int? y,
+  ) =>
+      (super.noSuchMethod(
+        Invocation.method(
+          #scrollBy,
+          [
+            x,
+            y,
+          ],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
   @override
-  _i5.Future<_i3.Point<int>> getScrollPosition() =>
-      (super.noSuchMethod(Invocation.method(#getScrollPosition, []),
-              returnValue: _i5.Future<_i3.Point<int>>.value(_FakePoint_1<int>(
-                  this, Invocation.method(#getScrollPosition, []))))
-          as _i5.Future<_i3.Point<int>>);
+  _i5.Future<_i3.Point<int>> getScrollPosition() => (super.noSuchMethod(
+        Invocation.method(
+          #getScrollPosition,
+          [],
+        ),
+        returnValue: _i5.Future<_i3.Point<int>>.value(_FakePoint_1<int>(
+          this,
+          Invocation.method(
+            #getScrollPosition,
+            [],
+          ),
+        )),
+      ) as _i5.Future<_i3.Point<int>>);
   @override
   _i5.Future<void> enableDebugging(bool? enabled) => (super.noSuchMethod(
-      Invocation.method(#enableDebugging, [enabled]),
-      returnValue: _i5.Future<void>.value(),
-      returnValueForMissingStub: _i5.Future<void>.value()) as _i5.Future<void>);
+        Invocation.method(
+          #enableDebugging,
+          [enabled],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
   @override
-  _i5.Future<void> enableGestureNavigation(bool? enabled) => (super
-          .noSuchMethod(Invocation.method(#enableGestureNavigation, [enabled]),
-              returnValue: _i5.Future<void>.value(),
-              returnValueForMissingStub: _i5.Future<void>.value())
-      as _i5.Future<void>);
+  _i5.Future<void> enableGestureNavigation(bool? enabled) =>
+      (super.noSuchMethod(
+        Invocation.method(
+          #enableGestureNavigation,
+          [enabled],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
   @override
   _i5.Future<void> enableZoom(bool? enabled) => (super.noSuchMethod(
-      Invocation.method(#enableZoom, [enabled]),
-      returnValue: _i5.Future<void>.value(),
-      returnValueForMissingStub: _i5.Future<void>.value()) as _i5.Future<void>);
+        Invocation.method(
+          #enableZoom,
+          [enabled],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
   @override
   _i5.Future<void> setBackgroundColor(_i7.Color? color) => (super.noSuchMethod(
-      Invocation.method(#setBackgroundColor, [color]),
-      returnValue: _i5.Future<void>.value(),
-      returnValueForMissingStub: _i5.Future<void>.value()) as _i5.Future<void>);
+        Invocation.method(
+          #setBackgroundColor,
+          [color],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
   @override
   _i5.Future<void> setJavaScriptMode(_i2.JavaScriptMode? javaScriptMode) =>
       (super.noSuchMethod(
-              Invocation.method(#setJavaScriptMode, [javaScriptMode]),
-              returnValue: _i5.Future<void>.value(),
-              returnValueForMissingStub: _i5.Future<void>.value())
-          as _i5.Future<void>);
+        Invocation.method(
+          #setJavaScriptMode,
+          [javaScriptMode],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
   @override
   _i5.Future<void> setUserAgent(String? userAgent) => (super.noSuchMethod(
-      Invocation.method(#setUserAgent, [userAgent]),
-      returnValue: _i5.Future<void>.value(),
-      returnValueForMissingStub: _i5.Future<void>.value()) as _i5.Future<void>);
+        Invocation.method(
+          #setUserAgent,
+          [userAgent],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
+}
+
+/// A class which mocks [PlatformNavigationDelegate].
+///
+/// See the documentation for Mockito's code generation for more information.
+class MockPlatformNavigationDelegate extends _i1.Mock
+    implements _i6.PlatformNavigationDelegate {
+  MockPlatformNavigationDelegate() {
+    _i1.throwOnMissingStub(this);
+  }
+
+  @override
+  _i2.PlatformNavigationDelegateCreationParams get params =>
+      (super.noSuchMethod(
+        Invocation.getter(#params),
+        returnValue: _FakePlatformNavigationDelegateCreationParams_2(
+          this,
+          Invocation.getter(#params),
+        ),
+      ) as _i2.PlatformNavigationDelegateCreationParams);
+  @override
+  _i5.Future<void> setOnNavigationRequest(
+          _i6.NavigationRequestCallback? onNavigationRequest) =>
+      (super.noSuchMethod(
+        Invocation.method(
+          #setOnNavigationRequest,
+          [onNavigationRequest],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
+  @override
+  _i5.Future<void> setOnPageStarted(_i6.PageEventCallback? onPageStarted) =>
+      (super.noSuchMethod(
+        Invocation.method(
+          #setOnPageStarted,
+          [onPageStarted],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
+  @override
+  _i5.Future<void> setOnPageFinished(_i6.PageEventCallback? onPageFinished) =>
+      (super.noSuchMethod(
+        Invocation.method(
+          #setOnPageFinished,
+          [onPageFinished],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
+  @override
+  _i5.Future<void> setOnProgress(_i6.ProgressCallback? onProgress) =>
+      (super.noSuchMethod(
+        Invocation.method(
+          #setOnProgress,
+          [onProgress],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
+  @override
+  _i5.Future<void> setOnWebResourceError(
+          _i6.WebResourceErrorCallback? onWebResourceError) =>
+      (super.noSuchMethod(
+        Invocation.method(
+          #setOnWebResourceError,
+          [onWebResourceError],
+        ),
+        returnValue: _i5.Future<void>.value(),
+        returnValueForMissingStub: _i5.Future<void>.value(),
+      ) as _i5.Future<void>);
 }
diff --git a/packages/webview_flutter/webview_flutter/test/v4/webview_cookie_manager_test.dart b/packages/webview_flutter/webview_flutter/test/v4/webview_cookie_manager_test.dart
index e815240..f366e79 100644
--- a/packages/webview_flutter/webview_flutter/test/v4/webview_cookie_manager_test.dart
+++ b/packages/webview_flutter/webview_flutter/test/v4/webview_cookie_manager_test.dart
@@ -5,7 +5,7 @@
 import 'package:flutter_test/flutter_test.dart';
 import 'package:mockito/annotations.dart';
 import 'package:mockito/mockito.dart';
-import 'package:webview_flutter/src/v4/src/webview_cookie_manager.dart';
+import 'package:webview_flutter/src/v4/webview_flutter.dart';
 import 'package:webview_flutter_platform_interface/v4/webview_flutter_platform_interface.dart';
 
 import 'webview_cookie_manager_test.mocks.dart';
diff --git a/packages/webview_flutter/webview_flutter/test/v4/webview_cookie_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter/test/v4/webview_cookie_manager_test.mocks.dart
index 4bca8b6..48fc685 100644
--- a/packages/webview_flutter/webview_flutter/test/v4/webview_cookie_manager_test.mocks.dart
+++ b/packages/webview_flutter/webview_flutter/test/v4/webview_cookie_manager_test.mocks.dart
@@ -1,4 +1,4 @@
-// Mocks generated by Mockito 5.3.0 from annotations
+// Mocks generated by Mockito 5.3.1 from annotations
 // in webview_flutter/test/v4/webview_cookie_manager_test.dart.
 // Do not manually edit this file.
 
@@ -25,8 +25,12 @@
 class _FakePlatformWebViewCookieManagerCreationParams_0 extends _i1.SmartFake
     implements _i2.PlatformWebViewCookieManagerCreationParams {
   _FakePlatformWebViewCookieManagerCreationParams_0(
-      Object parent, Invocation parentInvocation)
-      : super(parent, parentInvocation);
+    Object parent,
+    Invocation parentInvocation,
+  ) : super(
+          parent,
+          parentInvocation,
+        );
 }
 
 /// A class which mocks [PlatformWebViewCookieManager].
@@ -40,17 +44,28 @@
 
   @override
   _i2.PlatformWebViewCookieManagerCreationParams get params =>
-      (super.noSuchMethod(Invocation.getter(#params),
-              returnValue: _FakePlatformWebViewCookieManagerCreationParams_0(
-                  this, Invocation.getter(#params)))
-          as _i2.PlatformWebViewCookieManagerCreationParams);
+      (super.noSuchMethod(
+        Invocation.getter(#params),
+        returnValue: _FakePlatformWebViewCookieManagerCreationParams_0(
+          this,
+          Invocation.getter(#params),
+        ),
+      ) as _i2.PlatformWebViewCookieManagerCreationParams);
   @override
-  _i4.Future<bool> clearCookies() =>
-      (super.noSuchMethod(Invocation.method(#clearCookies, []),
-          returnValue: _i4.Future<bool>.value(false)) as _i4.Future<bool>);
+  _i4.Future<bool> clearCookies() => (super.noSuchMethod(
+        Invocation.method(
+          #clearCookies,
+          [],
+        ),
+        returnValue: _i4.Future<bool>.value(false),
+      ) as _i4.Future<bool>);
   @override
   _i4.Future<void> setCookie(_i2.WebViewCookie? cookie) => (super.noSuchMethod(
-      Invocation.method(#setCookie, [cookie]),
-      returnValue: _i4.Future<void>.value(),
-      returnValueForMissingStub: _i4.Future<void>.value()) as _i4.Future<void>);
+        Invocation.method(
+          #setCookie,
+          [cookie],
+        ),
+        returnValue: _i4.Future<void>.value(),
+        returnValueForMissingStub: _i4.Future<void>.value(),
+      ) as _i4.Future<void>);
 }
diff --git a/packages/webview_flutter/webview_flutter/test/v4/webview_widget_test.dart b/packages/webview_flutter/webview_flutter/test/v4/webview_widget_test.dart
index 455d8b3..26f82c0 100644
--- a/packages/webview_flutter/webview_flutter/test/v4/webview_widget_test.dart
+++ b/packages/webview_flutter/webview_flutter/test/v4/webview_widget_test.dart
@@ -77,8 +77,7 @@
 }
 
 class TestPlatformWebViewWidget extends PlatformWebViewWidget {
-  TestPlatformWebViewWidget(PlatformWebViewWidgetCreationParams params)
-      : super.implementation(params);
+  TestPlatformWebViewWidget(super.params) : super.implementation();
 
   @override
   Widget build(BuildContext context) {
diff --git a/packages/webview_flutter/webview_flutter/test/v4/webview_widget_test.mocks.dart b/packages/webview_flutter/webview_flutter/test/v4/webview_widget_test.mocks.dart
index e481d75..7827308 100644
--- a/packages/webview_flutter/webview_flutter/test/v4/webview_widget_test.mocks.dart
+++ b/packages/webview_flutter/webview_flutter/test/v4/webview_widget_test.mocks.dart
@@ -1,4 +1,4 @@
-// Mocks generated by Mockito 5.3.0 from annotations
+// Mocks generated by Mockito 5.3.1 from annotations
 // in webview_flutter/test/v4/webview_widget_test.dart.
 // Do not manually edit this file.
 
@@ -33,26 +33,44 @@
 class _FakePlatformWebViewControllerCreationParams_0 extends _i1.SmartFake
     implements _i2.PlatformWebViewControllerCreationParams {
   _FakePlatformWebViewControllerCreationParams_0(
-      Object parent, Invocation parentInvocation)
-      : super(parent, parentInvocation);
+    Object parent,
+    Invocation parentInvocation,
+  ) : super(
+          parent,
+          parentInvocation,
+        );
 }
 
 class _FakePoint_1<T extends num> extends _i1.SmartFake
     implements _i3.Point<T> {
-  _FakePoint_1(Object parent, Invocation parentInvocation)
-      : super(parent, parentInvocation);
+  _FakePoint_1(
+    Object parent,
+    Invocation parentInvocation,
+  ) : super(
+          parent,
+          parentInvocation,
+        );
 }
 
 class _FakePlatformWebViewWidgetCreationParams_2 extends _i1.SmartFake
     implements _i2.PlatformWebViewWidgetCreationParams {
   _FakePlatformWebViewWidgetCreationParams_2(
-      Object parent, Invocation parentInvocation)
-      : super(parent, parentInvocation);
+    Object parent,
+    Invocation parentInvocation,
+  ) : super(
+          parent,
+          parentInvocation,
+        );
 }
 
 class _FakeWidget_3 extends _i1.SmartFake implements _i4.Widget {
-  _FakeWidget_3(Object parent, Invocation parentInvocation)
-      : super(parent, parentInvocation);
+  _FakeWidget_3(
+    Object parent,
+    Invocation parentInvocation,
+  ) : super(
+          parent,
+          parentInvocation,
+        );
 
   @override
   String toString({_i5.DiagnosticLevel? minLevel = _i5.DiagnosticLevel.info}) =>
@@ -69,157 +87,284 @@
   }
 
   @override
-  _i2.PlatformWebViewControllerCreationParams get params =>
-      (super.noSuchMethod(Invocation.getter(#params),
-              returnValue: _FakePlatformWebViewControllerCreationParams_0(
-                  this, Invocation.getter(#params)))
-          as _i2.PlatformWebViewControllerCreationParams);
+  _i2.PlatformWebViewControllerCreationParams get params => (super.noSuchMethod(
+        Invocation.getter(#params),
+        returnValue: _FakePlatformWebViewControllerCreationParams_0(
+          this,
+          Invocation.getter(#params),
+        ),
+      ) as _i2.PlatformWebViewControllerCreationParams);
   @override
   _i7.Future<void> loadFile(String? absoluteFilePath) => (super.noSuchMethod(
-      Invocation.method(#loadFile, [absoluteFilePath]),
-      returnValue: _i7.Future<void>.value(),
-      returnValueForMissingStub: _i7.Future<void>.value()) as _i7.Future<void>);
+        Invocation.method(
+          #loadFile,
+          [absoluteFilePath],
+        ),
+        returnValue: _i7.Future<void>.value(),
+        returnValueForMissingStub: _i7.Future<void>.value(),
+      ) as _i7.Future<void>);
   @override
   _i7.Future<void> loadFlutterAsset(String? key) => (super.noSuchMethod(
-      Invocation.method(#loadFlutterAsset, [key]),
-      returnValue: _i7.Future<void>.value(),
-      returnValueForMissingStub: _i7.Future<void>.value()) as _i7.Future<void>);
+        Invocation.method(
+          #loadFlutterAsset,
+          [key],
+        ),
+        returnValue: _i7.Future<void>.value(),
+        returnValueForMissingStub: _i7.Future<void>.value(),
+      ) as _i7.Future<void>);
   @override
-  _i7.Future<void> loadHtmlString(String? html, {String? baseUrl}) =>
+  _i7.Future<void> loadHtmlString(
+    String? html, {
+    String? baseUrl,
+  }) =>
       (super.noSuchMethod(
-              Invocation.method(#loadHtmlString, [html], {#baseUrl: baseUrl}),
-              returnValue: _i7.Future<void>.value(),
-              returnValueForMissingStub: _i7.Future<void>.value())
-          as _i7.Future<void>);
+        Invocation.method(
+          #loadHtmlString,
+          [html],
+          {#baseUrl: baseUrl},
+        ),
+        returnValue: _i7.Future<void>.value(),
+        returnValueForMissingStub: _i7.Future<void>.value(),
+      ) as _i7.Future<void>);
   @override
   _i7.Future<void> loadRequest(_i2.LoadRequestParams? params) =>
-      (super.noSuchMethod(Invocation.method(#loadRequest, [params]),
-              returnValue: _i7.Future<void>.value(),
-              returnValueForMissingStub: _i7.Future<void>.value())
-          as _i7.Future<void>);
+      (super.noSuchMethod(
+        Invocation.method(
+          #loadRequest,
+          [params],
+        ),
+        returnValue: _i7.Future<void>.value(),
+        returnValueForMissingStub: _i7.Future<void>.value(),
+      ) as _i7.Future<void>);
   @override
-  _i7.Future<String?> currentUrl() =>
-      (super.noSuchMethod(Invocation.method(#currentUrl, []),
-          returnValue: _i7.Future<String?>.value()) as _i7.Future<String?>);
+  _i7.Future<String?> currentUrl() => (super.noSuchMethod(
+        Invocation.method(
+          #currentUrl,
+          [],
+        ),
+        returnValue: _i7.Future<String?>.value(),
+      ) as _i7.Future<String?>);
   @override
-  _i7.Future<bool> canGoBack() =>
-      (super.noSuchMethod(Invocation.method(#canGoBack, []),
-          returnValue: _i7.Future<bool>.value(false)) as _i7.Future<bool>);
+  _i7.Future<bool> canGoBack() => (super.noSuchMethod(
+        Invocation.method(
+          #canGoBack,
+          [],
+        ),
+        returnValue: _i7.Future<bool>.value(false),
+      ) as _i7.Future<bool>);
   @override
-  _i7.Future<bool> canGoForward() =>
-      (super.noSuchMethod(Invocation.method(#canGoForward, []),
-          returnValue: _i7.Future<bool>.value(false)) as _i7.Future<bool>);
+  _i7.Future<bool> canGoForward() => (super.noSuchMethod(
+        Invocation.method(
+          #canGoForward,
+          [],
+        ),
+        returnValue: _i7.Future<bool>.value(false),
+      ) as _i7.Future<bool>);
   @override
   _i7.Future<void> goBack() => (super.noSuchMethod(
-      Invocation.method(#goBack, []),
-      returnValue: _i7.Future<void>.value(),
-      returnValueForMissingStub: _i7.Future<void>.value()) as _i7.Future<void>);
+        Invocation.method(
+          #goBack,
+          [],
+        ),
+        returnValue: _i7.Future<void>.value(),
+        returnValueForMissingStub: _i7.Future<void>.value(),
+      ) as _i7.Future<void>);
   @override
   _i7.Future<void> goForward() => (super.noSuchMethod(
-      Invocation.method(#goForward, []),
-      returnValue: _i7.Future<void>.value(),
-      returnValueForMissingStub: _i7.Future<void>.value()) as _i7.Future<void>);
+        Invocation.method(
+          #goForward,
+          [],
+        ),
+        returnValue: _i7.Future<void>.value(),
+        returnValueForMissingStub: _i7.Future<void>.value(),
+      ) as _i7.Future<void>);
   @override
   _i7.Future<void> reload() => (super.noSuchMethod(
-      Invocation.method(#reload, []),
-      returnValue: _i7.Future<void>.value(),
-      returnValueForMissingStub: _i7.Future<void>.value()) as _i7.Future<void>);
+        Invocation.method(
+          #reload,
+          [],
+        ),
+        returnValue: _i7.Future<void>.value(),
+        returnValueForMissingStub: _i7.Future<void>.value(),
+      ) as _i7.Future<void>);
   @override
   _i7.Future<void> clearCache() => (super.noSuchMethod(
-      Invocation.method(#clearCache, []),
-      returnValue: _i7.Future<void>.value(),
-      returnValueForMissingStub: _i7.Future<void>.value()) as _i7.Future<void>);
+        Invocation.method(
+          #clearCache,
+          [],
+        ),
+        returnValue: _i7.Future<void>.value(),
+        returnValueForMissingStub: _i7.Future<void>.value(),
+      ) as _i7.Future<void>);
   @override
   _i7.Future<void> clearLocalStorage() => (super.noSuchMethod(
-      Invocation.method(#clearLocalStorage, []),
-      returnValue: _i7.Future<void>.value(),
-      returnValueForMissingStub: _i7.Future<void>.value()) as _i7.Future<void>);
+        Invocation.method(
+          #clearLocalStorage,
+          [],
+        ),
+        returnValue: _i7.Future<void>.value(),
+        returnValueForMissingStub: _i7.Future<void>.value(),
+      ) as _i7.Future<void>);
   @override
   _i7.Future<void> setPlatformNavigationDelegate(
           _i8.PlatformNavigationDelegate? handler) =>
       (super.noSuchMethod(
-              Invocation.method(#setPlatformNavigationDelegate, [handler]),
-              returnValue: _i7.Future<void>.value(),
-              returnValueForMissingStub: _i7.Future<void>.value())
-          as _i7.Future<void>);
+        Invocation.method(
+          #setPlatformNavigationDelegate,
+          [handler],
+        ),
+        returnValue: _i7.Future<void>.value(),
+        returnValueForMissingStub: _i7.Future<void>.value(),
+      ) as _i7.Future<void>);
   @override
   _i7.Future<void> runJavaScript(String? javaScript) => (super.noSuchMethod(
-      Invocation.method(#runJavaScript, [javaScript]),
-      returnValue: _i7.Future<void>.value(),
-      returnValueForMissingStub: _i7.Future<void>.value()) as _i7.Future<void>);
+        Invocation.method(
+          #runJavaScript,
+          [javaScript],
+        ),
+        returnValue: _i7.Future<void>.value(),
+        returnValueForMissingStub: _i7.Future<void>.value(),
+      ) as _i7.Future<void>);
   @override
   _i7.Future<String> runJavaScriptReturningResult(String? javaScript) =>
       (super.noSuchMethod(
-          Invocation.method(#runJavaScriptReturningResult, [javaScript]),
-          returnValue: _i7.Future<String>.value('')) as _i7.Future<String>);
+        Invocation.method(
+          #runJavaScriptReturningResult,
+          [javaScript],
+        ),
+        returnValue: _i7.Future<String>.value(''),
+      ) as _i7.Future<String>);
   @override
   _i7.Future<void> addJavaScriptChannel(
           _i6.JavaScriptChannelParams? javaScriptChannelParams) =>
       (super.noSuchMethod(
-          Invocation.method(#addJavaScriptChannel, [javaScriptChannelParams]),
-          returnValue: _i7.Future<void>.value(),
-          returnValueForMissingStub:
-              _i7.Future<void>.value()) as _i7.Future<void>);
+        Invocation.method(
+          #addJavaScriptChannel,
+          [javaScriptChannelParams],
+        ),
+        returnValue: _i7.Future<void>.value(),
+        returnValueForMissingStub: _i7.Future<void>.value(),
+      ) as _i7.Future<void>);
   @override
   _i7.Future<void> removeJavaScriptChannel(String? javaScriptChannelName) =>
       (super.noSuchMethod(
-          Invocation.method(#removeJavaScriptChannel, [javaScriptChannelName]),
-          returnValue: _i7.Future<void>.value(),
-          returnValueForMissingStub:
-              _i7.Future<void>.value()) as _i7.Future<void>);
+        Invocation.method(
+          #removeJavaScriptChannel,
+          [javaScriptChannelName],
+        ),
+        returnValue: _i7.Future<void>.value(),
+        returnValueForMissingStub: _i7.Future<void>.value(),
+      ) as _i7.Future<void>);
   @override
-  _i7.Future<String?> getTitle() =>
-      (super.noSuchMethod(Invocation.method(#getTitle, []),
-          returnValue: _i7.Future<String?>.value()) as _i7.Future<String?>);
+  _i7.Future<String?> getTitle() => (super.noSuchMethod(
+        Invocation.method(
+          #getTitle,
+          [],
+        ),
+        returnValue: _i7.Future<String?>.value(),
+      ) as _i7.Future<String?>);
   @override
-  _i7.Future<void> scrollTo(int? x, int? y) => (super.noSuchMethod(
-      Invocation.method(#scrollTo, [x, y]),
-      returnValue: _i7.Future<void>.value(),
-      returnValueForMissingStub: _i7.Future<void>.value()) as _i7.Future<void>);
+  _i7.Future<void> scrollTo(
+    int? x,
+    int? y,
+  ) =>
+      (super.noSuchMethod(
+        Invocation.method(
+          #scrollTo,
+          [
+            x,
+            y,
+          ],
+        ),
+        returnValue: _i7.Future<void>.value(),
+        returnValueForMissingStub: _i7.Future<void>.value(),
+      ) as _i7.Future<void>);
   @override
-  _i7.Future<void> scrollBy(int? x, int? y) => (super.noSuchMethod(
-      Invocation.method(#scrollBy, [x, y]),
-      returnValue: _i7.Future<void>.value(),
-      returnValueForMissingStub: _i7.Future<void>.value()) as _i7.Future<void>);
+  _i7.Future<void> scrollBy(
+    int? x,
+    int? y,
+  ) =>
+      (super.noSuchMethod(
+        Invocation.method(
+          #scrollBy,
+          [
+            x,
+            y,
+          ],
+        ),
+        returnValue: _i7.Future<void>.value(),
+        returnValueForMissingStub: _i7.Future<void>.value(),
+      ) as _i7.Future<void>);
   @override
-  _i7.Future<_i3.Point<int>> getScrollPosition() =>
-      (super.noSuchMethod(Invocation.method(#getScrollPosition, []),
-              returnValue: _i7.Future<_i3.Point<int>>.value(_FakePoint_1<int>(
-                  this, Invocation.method(#getScrollPosition, []))))
-          as _i7.Future<_i3.Point<int>>);
+  _i7.Future<_i3.Point<int>> getScrollPosition() => (super.noSuchMethod(
+        Invocation.method(
+          #getScrollPosition,
+          [],
+        ),
+        returnValue: _i7.Future<_i3.Point<int>>.value(_FakePoint_1<int>(
+          this,
+          Invocation.method(
+            #getScrollPosition,
+            [],
+          ),
+        )),
+      ) as _i7.Future<_i3.Point<int>>);
   @override
   _i7.Future<void> enableDebugging(bool? enabled) => (super.noSuchMethod(
-      Invocation.method(#enableDebugging, [enabled]),
-      returnValue: _i7.Future<void>.value(),
-      returnValueForMissingStub: _i7.Future<void>.value()) as _i7.Future<void>);
+        Invocation.method(
+          #enableDebugging,
+          [enabled],
+        ),
+        returnValue: _i7.Future<void>.value(),
+        returnValueForMissingStub: _i7.Future<void>.value(),
+      ) as _i7.Future<void>);
   @override
-  _i7.Future<void> enableGestureNavigation(bool? enabled) => (super
-          .noSuchMethod(Invocation.method(#enableGestureNavigation, [enabled]),
-              returnValue: _i7.Future<void>.value(),
-              returnValueForMissingStub: _i7.Future<void>.value())
-      as _i7.Future<void>);
+  _i7.Future<void> enableGestureNavigation(bool? enabled) =>
+      (super.noSuchMethod(
+        Invocation.method(
+          #enableGestureNavigation,
+          [enabled],
+        ),
+        returnValue: _i7.Future<void>.value(),
+        returnValueForMissingStub: _i7.Future<void>.value(),
+      ) as _i7.Future<void>);
   @override
   _i7.Future<void> enableZoom(bool? enabled) => (super.noSuchMethod(
-      Invocation.method(#enableZoom, [enabled]),
-      returnValue: _i7.Future<void>.value(),
-      returnValueForMissingStub: _i7.Future<void>.value()) as _i7.Future<void>);
+        Invocation.method(
+          #enableZoom,
+          [enabled],
+        ),
+        returnValue: _i7.Future<void>.value(),
+        returnValueForMissingStub: _i7.Future<void>.value(),
+      ) as _i7.Future<void>);
   @override
   _i7.Future<void> setBackgroundColor(_i9.Color? color) => (super.noSuchMethod(
-      Invocation.method(#setBackgroundColor, [color]),
-      returnValue: _i7.Future<void>.value(),
-      returnValueForMissingStub: _i7.Future<void>.value()) as _i7.Future<void>);
+        Invocation.method(
+          #setBackgroundColor,
+          [color],
+        ),
+        returnValue: _i7.Future<void>.value(),
+        returnValueForMissingStub: _i7.Future<void>.value(),
+      ) as _i7.Future<void>);
   @override
   _i7.Future<void> setJavaScriptMode(_i2.JavaScriptMode? javaScriptMode) =>
       (super.noSuchMethod(
-              Invocation.method(#setJavaScriptMode, [javaScriptMode]),
-              returnValue: _i7.Future<void>.value(),
-              returnValueForMissingStub: _i7.Future<void>.value())
-          as _i7.Future<void>);
+        Invocation.method(
+          #setJavaScriptMode,
+          [javaScriptMode],
+        ),
+        returnValue: _i7.Future<void>.value(),
+        returnValueForMissingStub: _i7.Future<void>.value(),
+      ) as _i7.Future<void>);
   @override
   _i7.Future<void> setUserAgent(String? userAgent) => (super.noSuchMethod(
-      Invocation.method(#setUserAgent, [userAgent]),
-      returnValue: _i7.Future<void>.value(),
-      returnValueForMissingStub: _i7.Future<void>.value()) as _i7.Future<void>);
+        Invocation.method(
+          #setUserAgent,
+          [userAgent],
+        ),
+        returnValue: _i7.Future<void>.value(),
+        returnValueForMissingStub: _i7.Future<void>.value(),
+      ) as _i7.Future<void>);
 }
 
 /// A class which mocks [PlatformWebViewWidget].
@@ -232,15 +377,25 @@
   }
 
   @override
-  _i2.PlatformWebViewWidgetCreationParams get params =>
-      (super.noSuchMethod(Invocation.getter(#params),
-              returnValue: _FakePlatformWebViewWidgetCreationParams_2(
-                  this, Invocation.getter(#params)))
-          as _i2.PlatformWebViewWidgetCreationParams);
+  _i2.PlatformWebViewWidgetCreationParams get params => (super.noSuchMethod(
+        Invocation.getter(#params),
+        returnValue: _FakePlatformWebViewWidgetCreationParams_2(
+          this,
+          Invocation.getter(#params),
+        ),
+      ) as _i2.PlatformWebViewWidgetCreationParams);
   @override
-  _i4.Widget build(_i4.BuildContext? context) =>
-      (super.noSuchMethod(Invocation.method(#build, [context]),
-              returnValue:
-                  _FakeWidget_3(this, Invocation.method(#build, [context])))
-          as _i4.Widget);
+  _i4.Widget build(_i4.BuildContext? context) => (super.noSuchMethod(
+        Invocation.method(
+          #build,
+          [context],
+        ),
+        returnValue: _FakeWidget_3(
+          this,
+          Invocation.method(
+            #build,
+            [context],
+          ),
+        ),
+      ) as _i4.Widget);
 }
diff --git a/packages/webview_flutter/webview_flutter/test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter/test/webview_flutter_test.dart
index b10366c..d797472 100644
--- a/packages/webview_flutter/webview_flutter/test/webview_flutter_test.dart
+++ b/packages/webview_flutter/webview_flutter/test/webview_flutter_test.dart
@@ -1234,10 +1234,10 @@
 // for the WebView.
 class TestPlatformWebView extends StatefulWidget {
   const TestPlatformWebView({
-    Key? key,
+    super.key,
     required this.mockWebViewPlatformController,
     this.onWebViewPlatformCreated,
-  }) : super(key: key);
+  });
 
   final MockWebViewPlatformController mockWebViewPlatformController;
   final WebViewPlatformCreatedCallback? onWebViewPlatformCreated;
diff --git a/packages/webview_flutter/webview_flutter/test/webview_flutter_test.mocks.dart b/packages/webview_flutter/webview_flutter/test/webview_flutter_test.mocks.dart
index a7a2100..c49abf2 100644
--- a/packages/webview_flutter/webview_flutter/test/webview_flutter_test.mocks.dart
+++ b/packages/webview_flutter/webview_flutter/test/webview_flutter_test.mocks.dart
@@ -1,4 +1,4 @@
-// Mocks generated by Mockito 5.3.0 from annotations
+// Mocks generated by Mockito 5.3.1 from annotations
 // in webview_flutter/test/webview_flutter_test.dart.
 // Do not manually edit this file.
 
@@ -31,8 +31,13 @@
 // ignore_for_file: subtype_of_sealed_class
 
 class _FakeWidget_0 extends _i1.SmartFake implements _i2.Widget {
-  _FakeWidget_0(Object parent, Invocation parentInvocation)
-      : super(parent, parentInvocation);
+  _FakeWidget_0(
+    Object parent,
+    Invocation parentInvocation,
+  ) : super(
+          parent,
+          parentInvocation,
+        );
 
   @override
   String toString({_i3.DiagnosticLevel? minLevel = _i3.DiagnosticLevel.info}) =>
@@ -48,38 +53,52 @@
   }
 
   @override
-  _i2.Widget build(
-          {_i2.BuildContext? context,
-          _i5.CreationParams? creationParams,
-          _i6.WebViewPlatformCallbacksHandler? webViewPlatformCallbacksHandler,
-          _i7.JavascriptChannelRegistry? javascriptChannelRegistry,
-          _i4.WebViewPlatformCreatedCallback? onWebViewPlatformCreated,
-          Set<_i3.Factory<_i8.OneSequenceGestureRecognizer>>?
-              gestureRecognizers}) =>
+  _i2.Widget build({
+    required _i2.BuildContext? context,
+    required _i5.CreationParams? creationParams,
+    required _i6.WebViewPlatformCallbacksHandler?
+        webViewPlatformCallbacksHandler,
+    required _i7.JavascriptChannelRegistry? javascriptChannelRegistry,
+    _i4.WebViewPlatformCreatedCallback? onWebViewPlatformCreated,
+    Set<_i3.Factory<_i8.OneSequenceGestureRecognizer>>? gestureRecognizers,
+  }) =>
       (super.noSuchMethod(
-          Invocation.method(#build, [], {
+        Invocation.method(
+          #build,
+          [],
+          {
             #context: context,
             #creationParams: creationParams,
             #webViewPlatformCallbacksHandler: webViewPlatformCallbacksHandler,
             #javascriptChannelRegistry: javascriptChannelRegistry,
             #onWebViewPlatformCreated: onWebViewPlatformCreated,
-            #gestureRecognizers: gestureRecognizers
-          }),
-          returnValue: _FakeWidget_0(
-              this,
-              Invocation.method(#build, [], {
-                #context: context,
-                #creationParams: creationParams,
-                #webViewPlatformCallbacksHandler:
-                    webViewPlatformCallbacksHandler,
-                #javascriptChannelRegistry: javascriptChannelRegistry,
-                #onWebViewPlatformCreated: onWebViewPlatformCreated,
-                #gestureRecognizers: gestureRecognizers
-              }))) as _i2.Widget);
+            #gestureRecognizers: gestureRecognizers,
+          },
+        ),
+        returnValue: _FakeWidget_0(
+          this,
+          Invocation.method(
+            #build,
+            [],
+            {
+              #context: context,
+              #creationParams: creationParams,
+              #webViewPlatformCallbacksHandler: webViewPlatformCallbacksHandler,
+              #javascriptChannelRegistry: javascriptChannelRegistry,
+              #onWebViewPlatformCreated: onWebViewPlatformCreated,
+              #gestureRecognizers: gestureRecognizers,
+            },
+          ),
+        ),
+      ) as _i2.Widget);
   @override
-  _i9.Future<bool> clearCookies() =>
-      (super.noSuchMethod(Invocation.method(#clearCookies, []),
-          returnValue: _i9.Future<bool>.value(false)) as _i9.Future<bool>);
+  _i9.Future<bool> clearCookies() => (super.noSuchMethod(
+        Invocation.method(
+          #clearCookies,
+          [],
+        ),
+        returnValue: _i9.Future<bool>.value(false),
+      ) as _i9.Future<bool>);
 }
 
 /// A class which mocks [WebViewPlatformController].
@@ -93,121 +112,234 @@
 
   @override
   _i9.Future<void> loadFile(String? absoluteFilePath) => (super.noSuchMethod(
-      Invocation.method(#loadFile, [absoluteFilePath]),
-      returnValue: _i9.Future<void>.value(),
-      returnValueForMissingStub: _i9.Future<void>.value()) as _i9.Future<void>);
+        Invocation.method(
+          #loadFile,
+          [absoluteFilePath],
+        ),
+        returnValue: _i9.Future<void>.value(),
+        returnValueForMissingStub: _i9.Future<void>.value(),
+      ) as _i9.Future<void>);
   @override
   _i9.Future<void> loadFlutterAsset(String? key) => (super.noSuchMethod(
-      Invocation.method(#loadFlutterAsset, [key]),
-      returnValue: _i9.Future<void>.value(),
-      returnValueForMissingStub: _i9.Future<void>.value()) as _i9.Future<void>);
+        Invocation.method(
+          #loadFlutterAsset,
+          [key],
+        ),
+        returnValue: _i9.Future<void>.value(),
+        returnValueForMissingStub: _i9.Future<void>.value(),
+      ) as _i9.Future<void>);
   @override
-  _i9.Future<void> loadHtmlString(String? html, {String? baseUrl}) =>
+  _i9.Future<void> loadHtmlString(
+    String? html, {
+    String? baseUrl,
+  }) =>
       (super.noSuchMethod(
-              Invocation.method(#loadHtmlString, [html], {#baseUrl: baseUrl}),
-              returnValue: _i9.Future<void>.value(),
-              returnValueForMissingStub: _i9.Future<void>.value())
-          as _i9.Future<void>);
+        Invocation.method(
+          #loadHtmlString,
+          [html],
+          {#baseUrl: baseUrl},
+        ),
+        returnValue: _i9.Future<void>.value(),
+        returnValueForMissingStub: _i9.Future<void>.value(),
+      ) as _i9.Future<void>);
   @override
-  _i9.Future<void> loadUrl(String? url, Map<String, String>? headers) =>
-      (super.noSuchMethod(Invocation.method(#loadUrl, [url, headers]),
-              returnValue: _i9.Future<void>.value(),
-              returnValueForMissingStub: _i9.Future<void>.value())
-          as _i9.Future<void>);
+  _i9.Future<void> loadUrl(
+    String? url,
+    Map<String, String>? headers,
+  ) =>
+      (super.noSuchMethod(
+        Invocation.method(
+          #loadUrl,
+          [
+            url,
+            headers,
+          ],
+        ),
+        returnValue: _i9.Future<void>.value(),
+        returnValueForMissingStub: _i9.Future<void>.value(),
+      ) as _i9.Future<void>);
   @override
   _i9.Future<void> loadRequest(_i5.WebViewRequest? request) =>
-      (super.noSuchMethod(Invocation.method(#loadRequest, [request]),
-              returnValue: _i9.Future<void>.value(),
-              returnValueForMissingStub: _i9.Future<void>.value())
-          as _i9.Future<void>);
+      (super.noSuchMethod(
+        Invocation.method(
+          #loadRequest,
+          [request],
+        ),
+        returnValue: _i9.Future<void>.value(),
+        returnValueForMissingStub: _i9.Future<void>.value(),
+      ) as _i9.Future<void>);
   @override
   _i9.Future<void> updateSettings(_i5.WebSettings? setting) =>
-      (super.noSuchMethod(Invocation.method(#updateSettings, [setting]),
-              returnValue: _i9.Future<void>.value(),
-              returnValueForMissingStub: _i9.Future<void>.value())
-          as _i9.Future<void>);
+      (super.noSuchMethod(
+        Invocation.method(
+          #updateSettings,
+          [setting],
+        ),
+        returnValue: _i9.Future<void>.value(),
+        returnValueForMissingStub: _i9.Future<void>.value(),
+      ) as _i9.Future<void>);
   @override
-  _i9.Future<String?> currentUrl() =>
-      (super.noSuchMethod(Invocation.method(#currentUrl, []),
-          returnValue: _i9.Future<String?>.value()) as _i9.Future<String?>);
+  _i9.Future<String?> currentUrl() => (super.noSuchMethod(
+        Invocation.method(
+          #currentUrl,
+          [],
+        ),
+        returnValue: _i9.Future<String?>.value(),
+      ) as _i9.Future<String?>);
   @override
-  _i9.Future<bool> canGoBack() =>
-      (super.noSuchMethod(Invocation.method(#canGoBack, []),
-          returnValue: _i9.Future<bool>.value(false)) as _i9.Future<bool>);
+  _i9.Future<bool> canGoBack() => (super.noSuchMethod(
+        Invocation.method(
+          #canGoBack,
+          [],
+        ),
+        returnValue: _i9.Future<bool>.value(false),
+      ) as _i9.Future<bool>);
   @override
-  _i9.Future<bool> canGoForward() =>
-      (super.noSuchMethod(Invocation.method(#canGoForward, []),
-          returnValue: _i9.Future<bool>.value(false)) as _i9.Future<bool>);
+  _i9.Future<bool> canGoForward() => (super.noSuchMethod(
+        Invocation.method(
+          #canGoForward,
+          [],
+        ),
+        returnValue: _i9.Future<bool>.value(false),
+      ) as _i9.Future<bool>);
   @override
   _i9.Future<void> goBack() => (super.noSuchMethod(
-      Invocation.method(#goBack, []),
-      returnValue: _i9.Future<void>.value(),
-      returnValueForMissingStub: _i9.Future<void>.value()) as _i9.Future<void>);
+        Invocation.method(
+          #goBack,
+          [],
+        ),
+        returnValue: _i9.Future<void>.value(),
+        returnValueForMissingStub: _i9.Future<void>.value(),
+      ) as _i9.Future<void>);
   @override
   _i9.Future<void> goForward() => (super.noSuchMethod(
-      Invocation.method(#goForward, []),
-      returnValue: _i9.Future<void>.value(),
-      returnValueForMissingStub: _i9.Future<void>.value()) as _i9.Future<void>);
+        Invocation.method(
+          #goForward,
+          [],
+        ),
+        returnValue: _i9.Future<void>.value(),
+        returnValueForMissingStub: _i9.Future<void>.value(),
+      ) as _i9.Future<void>);
   @override
   _i9.Future<void> reload() => (super.noSuchMethod(
-      Invocation.method(#reload, []),
-      returnValue: _i9.Future<void>.value(),
-      returnValueForMissingStub: _i9.Future<void>.value()) as _i9.Future<void>);
+        Invocation.method(
+          #reload,
+          [],
+        ),
+        returnValue: _i9.Future<void>.value(),
+        returnValueForMissingStub: _i9.Future<void>.value(),
+      ) as _i9.Future<void>);
   @override
   _i9.Future<void> clearCache() => (super.noSuchMethod(
-      Invocation.method(#clearCache, []),
-      returnValue: _i9.Future<void>.value(),
-      returnValueForMissingStub: _i9.Future<void>.value()) as _i9.Future<void>);
+        Invocation.method(
+          #clearCache,
+          [],
+        ),
+        returnValue: _i9.Future<void>.value(),
+        returnValueForMissingStub: _i9.Future<void>.value(),
+      ) as _i9.Future<void>);
   @override
   _i9.Future<String> evaluateJavascript(String? javascript) =>
-      (super.noSuchMethod(Invocation.method(#evaluateJavascript, [javascript]),
-          returnValue: _i9.Future<String>.value('')) as _i9.Future<String>);
+      (super.noSuchMethod(
+        Invocation.method(
+          #evaluateJavascript,
+          [javascript],
+        ),
+        returnValue: _i9.Future<String>.value(''),
+      ) as _i9.Future<String>);
   @override
   _i9.Future<void> runJavascript(String? javascript) => (super.noSuchMethod(
-      Invocation.method(#runJavascript, [javascript]),
-      returnValue: _i9.Future<void>.value(),
-      returnValueForMissingStub: _i9.Future<void>.value()) as _i9.Future<void>);
+        Invocation.method(
+          #runJavascript,
+          [javascript],
+        ),
+        returnValue: _i9.Future<void>.value(),
+        returnValueForMissingStub: _i9.Future<void>.value(),
+      ) as _i9.Future<void>);
   @override
   _i9.Future<String> runJavascriptReturningResult(String? javascript) =>
       (super.noSuchMethod(
-          Invocation.method(#runJavascriptReturningResult, [javascript]),
-          returnValue: _i9.Future<String>.value('')) as _i9.Future<String>);
+        Invocation.method(
+          #runJavascriptReturningResult,
+          [javascript],
+        ),
+        returnValue: _i9.Future<String>.value(''),
+      ) as _i9.Future<String>);
   @override
   _i9.Future<void> addJavascriptChannels(Set<String>? javascriptChannelNames) =>
       (super.noSuchMethod(
-          Invocation.method(#addJavascriptChannels, [javascriptChannelNames]),
-          returnValue: _i9.Future<void>.value(),
-          returnValueForMissingStub:
-              _i9.Future<void>.value()) as _i9.Future<void>);
+        Invocation.method(
+          #addJavascriptChannels,
+          [javascriptChannelNames],
+        ),
+        returnValue: _i9.Future<void>.value(),
+        returnValueForMissingStub: _i9.Future<void>.value(),
+      ) as _i9.Future<void>);
   @override
   _i9.Future<void> removeJavascriptChannels(
           Set<String>? javascriptChannelNames) =>
       (super.noSuchMethod(
-              Invocation.method(
-                  #removeJavascriptChannels, [javascriptChannelNames]),
-              returnValue: _i9.Future<void>.value(),
-              returnValueForMissingStub: _i9.Future<void>.value())
-          as _i9.Future<void>);
+        Invocation.method(
+          #removeJavascriptChannels,
+          [javascriptChannelNames],
+        ),
+        returnValue: _i9.Future<void>.value(),
+        returnValueForMissingStub: _i9.Future<void>.value(),
+      ) as _i9.Future<void>);
   @override
-  _i9.Future<String?> getTitle() =>
-      (super.noSuchMethod(Invocation.method(#getTitle, []),
-          returnValue: _i9.Future<String?>.value()) as _i9.Future<String?>);
+  _i9.Future<String?> getTitle() => (super.noSuchMethod(
+        Invocation.method(
+          #getTitle,
+          [],
+        ),
+        returnValue: _i9.Future<String?>.value(),
+      ) as _i9.Future<String?>);
   @override
-  _i9.Future<void> scrollTo(int? x, int? y) => (super.noSuchMethod(
-      Invocation.method(#scrollTo, [x, y]),
-      returnValue: _i9.Future<void>.value(),
-      returnValueForMissingStub: _i9.Future<void>.value()) as _i9.Future<void>);
+  _i9.Future<void> scrollTo(
+    int? x,
+    int? y,
+  ) =>
+      (super.noSuchMethod(
+        Invocation.method(
+          #scrollTo,
+          [
+            x,
+            y,
+          ],
+        ),
+        returnValue: _i9.Future<void>.value(),
+        returnValueForMissingStub: _i9.Future<void>.value(),
+      ) as _i9.Future<void>);
   @override
-  _i9.Future<void> scrollBy(int? x, int? y) => (super.noSuchMethod(
-      Invocation.method(#scrollBy, [x, y]),
-      returnValue: _i9.Future<void>.value(),
-      returnValueForMissingStub: _i9.Future<void>.value()) as _i9.Future<void>);
+  _i9.Future<void> scrollBy(
+    int? x,
+    int? y,
+  ) =>
+      (super.noSuchMethod(
+        Invocation.method(
+          #scrollBy,
+          [
+            x,
+            y,
+          ],
+        ),
+        returnValue: _i9.Future<void>.value(),
+        returnValueForMissingStub: _i9.Future<void>.value(),
+      ) as _i9.Future<void>);
   @override
-  _i9.Future<int> getScrollX() =>
-      (super.noSuchMethod(Invocation.method(#getScrollX, []),
-          returnValue: _i9.Future<int>.value(0)) as _i9.Future<int>);
+  _i9.Future<int> getScrollX() => (super.noSuchMethod(
+        Invocation.method(
+          #getScrollX,
+          [],
+        ),
+        returnValue: _i9.Future<int>.value(0),
+      ) as _i9.Future<int>);
   @override
-  _i9.Future<int> getScrollY() =>
-      (super.noSuchMethod(Invocation.method(#getScrollY, []),
-          returnValue: _i9.Future<int>.value(0)) as _i9.Future<int>);
+  _i9.Future<int> getScrollY() => (super.noSuchMethod(
+        Invocation.method(
+          #getScrollY,
+          [],
+        ),
+        returnValue: _i9.Future<int>.value(0),
+      ) as _i9.Future<int>);
 }
diff --git a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md
index ffe7c96..910d20d 100644
--- a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md
+++ b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md
@@ -1,7 +1,3 @@
-## 2.10.2
-
-* Updates internal code to release native objects automatically with InstanceManager.
-
 ## 2.10.1
 
 * Adds a method to the `WebView` wrapper to retrieve the X and Y positions simultaneously.
diff --git a/packages/webview_flutter/webview_flutter_android/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/pubspec.yaml
index f5f2e3c..4128678 100644
--- a/packages/webview_flutter/webview_flutter_android/pubspec.yaml
+++ b/packages/webview_flutter/webview_flutter_android/pubspec.yaml
@@ -2,7 +2,8 @@
 description: A Flutter plugin that provides a WebView widget on Android.
 repository: https://github.com/flutter/plugins/tree/main/packages/webview_flutter/webview_flutter_android
 issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22
-version: 2.10.2
+version: 2.10.1
+publish_to: none
 
 environment:
   sdk: ">=2.14.0 <3.0.0"
@@ -19,7 +20,8 @@
 dependencies:
   flutter:
     sdk: flutter
-  webview_flutter_platform_interface: ^1.8.0
+  webview_flutter_platform_interface:
+    path: ../webview_flutter_platform_interface
 
 dev_dependencies:
   build_runner: ^2.1.4