[webview_flutter] Migrate webview_flutter package to analysis_options.yaml (#4552)

diff --git a/packages/webview_flutter/webview_flutter/CHANGELOG.md b/packages/webview_flutter/webview_flutter/CHANGELOG.md
index 5dd2ea0..63d95c0 100644
--- a/packages/webview_flutter/webview_flutter/CHANGELOG.md
+++ b/packages/webview_flutter/webview_flutter/CHANGELOG.md
@@ -2,6 +2,7 @@
 
 * Updates example app Android compileSdkVersion to 31.
 * Integration test fixes.
+* Updates code for new analysis options.
 
 ## 2.3.1
 
diff --git a/packages/webview_flutter/webview_flutter/analysis_options.yaml b/packages/webview_flutter/webview_flutter/analysis_options.yaml
deleted file mode 100644
index 5aeb4e7..0000000
--- a/packages/webview_flutter/webview_flutter/analysis_options.yaml
+++ /dev/null
@@ -1 +0,0 @@
-include: ../../../analysis_options_legacy.yaml
diff --git a/packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test.dart
index 1630d6e..cc74afd 100644
--- a/packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test.dart
+++ b/packages/webview_flutter/webview_flutter/example/integration_test/webview_flutter_test.dart
@@ -204,7 +204,7 @@
     );
 
     resizeButtonTapped = true;
-    await tester.tap(find.byKey(const ValueKey('resizeButton')));
+    await tester.tap(find.byKey(const ValueKey<String>('resizeButton')));
     await tester.pumpAndSettle();
     expect(buttonTapResizeCompleter.future, completes);
   });
@@ -460,10 +460,10 @@
 
     testWidgets('Video plays inline when allowsInlineMediaPlayback is true',
         (WidgetTester tester) async {
-      Completer<WebViewController> controllerCompleter =
+      final Completer<WebViewController> controllerCompleter =
           Completer<WebViewController>();
-      Completer<void> pageLoaded = Completer<void>();
-      Completer<void> videoPlaying = Completer<void>();
+      final Completer<void> pageLoaded = Completer<void>();
+      final Completer<void> videoPlaying = Completer<void>();
 
       await tester.pumpWidget(
         Directionality(
@@ -494,7 +494,7 @@
           ),
         ),
       );
-      WebViewController controller = await controllerCompleter.future;
+      final WebViewController controller = await controllerCompleter.future;
       await pageLoaded.future;
 
       // Pump once to trigger the video play.
@@ -503,7 +503,7 @@
       // Makes sure we get the correct event that indicates the video is actually playing.
       await videoPlaying.future;
 
-      String fullScreen =
+      final String fullScreen =
           await controller.runJavascriptReturningResult('isFullScreen();');
       expect(fullScreen, _webviewBool(false));
     });
@@ -512,10 +512,10 @@
     testWidgets(
         'Video plays full screen when allowsInlineMediaPlayback is false',
         (WidgetTester tester) async {
-      Completer<WebViewController> controllerCompleter =
+      final Completer<WebViewController> controllerCompleter =
           Completer<WebViewController>();
-      Completer<void> pageLoaded = Completer<void>();
-      Completer<void> videoPlaying = Completer<void>();
+      final Completer<void> pageLoaded = Completer<void>();
+      final Completer<void> videoPlaying = Completer<void>();
 
       await tester.pumpWidget(
         Directionality(
@@ -546,7 +546,7 @@
           ),
         ),
       );
-      WebViewController controller = await controllerCompleter.future;
+      final WebViewController controller = await controllerCompleter.future;
       await pageLoaded.future;
 
       // Pump once to trigger the video play.
@@ -555,7 +555,7 @@
       // Makes sure we get the correct event that indicates the video is actually playing.
       await videoPlaying.future;
 
-      String fullScreen =
+      final String fullScreen =
           await controller.runJavascriptReturningResult('isFullScreen();');
       expect(fullScreen, _webviewBool(true));
     }, skip: Platform.isAndroid);
@@ -733,7 +733,7 @@
   });
 
   testWidgets('getTitle', (WidgetTester tester) async {
-    final String getTitleTest = '''
+    const String getTitleTest = '''
         <!DOCTYPE html><html>
         <head><title>Some title</title>
         </head>
@@ -784,7 +784,7 @@
   group('Programmatic Scroll', () {
     // TODO(bparrishMines): skipped due to https://github.com/flutter/flutter/issues/86757.
     testWidgets('setAndGetScrollPosition', (WidgetTester tester) async {
-      final String scrollTestPage = '''
+      const String scrollTestPage = '''
         <!DOCTYPE html>
         <html>
           <head>
@@ -831,7 +831,7 @@
       final WebViewController controller = await controllerCompleter.future;
       await pageLoaded.future;
 
-      await tester.pumpAndSettle(Duration(seconds: 3));
+      await tester.pumpAndSettle(const Duration(seconds: 3));
 
       int scrollPosX = await controller.getScrollX();
       int scrollPosY = await controller.getScrollY();
@@ -871,7 +871,7 @@
 
     // TODO(bparrishMines): skipped due to https://github.com/flutter/flutter/issues/86757.
     testWidgets('setAndGetScrollPosition', (WidgetTester tester) async {
-      final String scrollTestPage = '''
+      const String scrollTestPage = '''
         <!DOCTYPE html>
         <html>
           <head>
@@ -918,7 +918,7 @@
       final WebViewController controller = await controllerCompleter.future;
       await pageLoaded.future;
 
-      await tester.pumpAndSettle(Duration(seconds: 3));
+      await tester.pumpAndSettle(const Duration(seconds: 3));
 
       // Check scrollTo()
       const int X_SCROLL = 123;
@@ -941,7 +941,7 @@
     // TODO(bparrishMines): skipped due to https://github.com/flutter/flutter/issues/86757.
     testWidgets('inputs are scrolled into view when focused',
         (WidgetTester tester) async {
-      final String scrollTestPage = '''
+      const String scrollTestPage = '''
         <!DOCTYPE html>
         <html>
           <head>
@@ -993,7 +993,7 @@
             ),
           ),
         );
-        await Future.delayed(Duration(milliseconds: 20));
+        await Future<dynamic>.delayed(const Duration(milliseconds: 20));
         await tester.pump();
       });
 
@@ -1002,7 +1002,7 @@
       final String viewportRectJSON = await _runJavascriptReturningResult(
           controller, 'JSON.stringify(viewport.getBoundingClientRect())');
       final Map<String, dynamic> viewportRectRelativeToViewport =
-          jsonDecode(viewportRectJSON);
+          jsonDecode(viewportRectJSON) as Map<String, dynamic>;
 
       // Check that the input is originally outside of the viewport.
 
@@ -1010,7 +1010,7 @@
           await _runJavascriptReturningResult(
               controller, 'JSON.stringify(inputEl.getBoundingClientRect())');
       final Map<String, dynamic> initialInputClientRectRelativeToViewport =
-          jsonDecode(initialInputClientRectJSON);
+          jsonDecode(initialInputClientRectJSON) as Map<String, dynamic>;
 
       expect(
           initialInputClientRectRelativeToViewport['bottom'] <=
@@ -1025,7 +1025,7 @@
           await _runJavascriptReturningResult(
               controller, 'JSON.stringify(inputEl.getBoundingClientRect())');
       final Map<String, dynamic> lastInputClientRectRelativeToViewport =
-          jsonDecode(lastInputClientRectJSON);
+          jsonDecode(lastInputClientRectJSON) as Map<String, dynamic>;
 
       expect(
           lastInputClientRectRelativeToViewport['top'] >=
@@ -1048,7 +1048,7 @@
   });
 
   group('NavigationDelegate', () {
-    final String blankPage = "<!DOCTYPE html><head></head><body></body></html>";
+    const String blankPage = '<!DOCTYPE html><head></head><body></body></html>';
     final String blankPageEncoded = 'data:text/html;charset=utf-8;base64,' +
         base64Encode(const Utf8Encoder().convert(blankPage));
 
@@ -1144,7 +1144,7 @@
     testWidgets(
       'onWebResourceError only called for main frame',
       (WidgetTester tester) async {
-        final String iframeTest = '''
+        const String iframeTest = '''
         <!DOCTYPE html>
         <html>
         <head>
@@ -1357,7 +1357,7 @@
   testWidgets(
     'JavaScript does not run in parent window',
     (WidgetTester tester) async {
-      final String iframe = '''
+      const String iframe = '''
         <!DOCTYPE html>
         <script>
           window.onload = () => {
@@ -1443,11 +1443,13 @@
   if (defaultTargetPlatform == TargetPlatform.iOS) {
     return await controller.runJavascriptReturningResult(js);
   }
-  return jsonDecode(await controller.runJavascriptReturningResult(js));
+  return jsonDecode(await controller.runJavascriptReturningResult(js))
+      as String;
 }
 
 class ResizableWebView extends StatefulWidget {
-  ResizableWebView({required this.onResize, required this.onPageFinished});
+  const ResizableWebView(
+      {required this.onResize, required this.onPageFinished});
 
   final JavascriptMessageHandler onResize;
   final VoidCallback onPageFinished;
@@ -1502,14 +1504,14 @@
             ),
           ),
           TextButton(
-            key: Key('resizeButton'),
+            key: const Key('resizeButton'),
             onPressed: () {
               setState(() {
                 webViewWidth += 100.0;
                 webViewHeight += 100.0;
               });
             },
-            child: Text('ResizeButton'),
+            child: const Text('ResizeButton'),
           ),
         ],
       ),
diff --git a/packages/webview_flutter/webview_flutter/example/lib/main.dart b/packages/webview_flutter/webview_flutter/example/lib/main.dart
index b660ce3..0a8928e 100644
--- a/packages/webview_flutter/webview_flutter/example/lib/main.dart
+++ b/packages/webview_flutter/webview_flutter/example/lib/main.dart
@@ -40,7 +40,9 @@
   @override
   void initState() {
     super.initState();
-    if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView();
+    if (Platform.isAndroid) {
+      WebView.platform = SurfaceAndroidWebView();
+    }
   }
 
   @override
@@ -64,7 +66,7 @@
             _controller.complete(webViewController);
           },
           onProgress: (int progress) {
-            print("WebView is loading (progress : $progress%)");
+            print('WebView is loading (progress : $progress%)');
           },
           javascriptChannels: <JavascriptChannel>{
             _toasterJavascriptChannel(context),
@@ -207,7 +209,7 @@
     );
   }
 
-  void _onShowUserAgent(
+  Future<void> _onShowUserAgent(
       WebViewController controller, BuildContext context) async {
     // Send a message with the user agent string to the Toaster JavaScript channel we registered
     // with the WebView.
@@ -215,7 +217,7 @@
         'Toaster.postMessage("User Agent: " + navigator.userAgent);');
   }
 
-  void _onListCookies(
+  Future<void> _onListCookies(
       WebViewController controller, BuildContext context) async {
     final String cookies =
         await controller.runJavascriptReturningResult('document.cookie');
@@ -232,7 +234,8 @@
     ));
   }
 
-  void _onAddToCache(WebViewController controller, BuildContext context) async {
+  Future<void> _onAddToCache(
+      WebViewController controller, BuildContext context) async {
     await controller.runJavascript(
         'caches.open("test_caches_entry"); localStorage["test_localStorage"] = "dummy_entry";');
     // ignore: deprecated_member_use
@@ -241,21 +244,23 @@
     ));
   }
 
-  void _onListCache(WebViewController controller, BuildContext context) async {
+  Future<void> _onListCache(
+      WebViewController controller, BuildContext context) async {
     await controller.runJavascript('caches.keys()'
         '.then((cacheKeys) => JSON.stringify({"cacheKeys" : cacheKeys, "localStorage" : localStorage}))'
         '.then((caches) => Toaster.postMessage(caches))');
   }
 
-  void _onClearCache(WebViewController controller, BuildContext context) async {
+  Future<void> _onClearCache(
+      WebViewController controller, BuildContext context) async {
     await controller.clearCache();
     // ignore: deprecated_member_use
     Scaffold.of(context).showSnackBar(const SnackBar(
-      content: Text("Cache cleared."),
+      content: Text('Cache cleared.'),
     ));
   }
 
-  void _onClearCookies(BuildContext context) async {
+  Future<void> _onClearCookies(BuildContext context) async {
     final bool hadCookies = await cookieManager.clearCookies();
     String message = 'There were cookies. Now, they are gone!';
     if (!hadCookies) {
@@ -267,7 +272,7 @@
     ));
   }
 
-  void _onNavigationDelegateExample(
+  Future<void> _onNavigationDelegateExample(
       WebViewController controller, BuildContext context) async {
     final String contentBase64 =
         base64Encode(const Utf8Encoder().convert(kNavigationExamplePage));
@@ -316,7 +321,7 @@
                       } else {
                         // ignore: deprecated_member_use
                         Scaffold.of(context).showSnackBar(
-                          const SnackBar(content: Text("No back history item")),
+                          const SnackBar(content: Text('No back history item')),
                         );
                         return;
                       }
@@ -333,7 +338,7 @@
                         // ignore: deprecated_member_use
                         Scaffold.of(context).showSnackBar(
                           const SnackBar(
-                              content: Text("No forward history item")),
+                              content: Text('No forward history item')),
                         );
                         return;
                       }
diff --git a/packages/webview_flutter/webview_flutter/example/pubspec.yaml b/packages/webview_flutter/webview_flutter/example/pubspec.yaml
index 6b668eb..53fdd56 100644
--- a/packages/webview_flutter/webview_flutter/example/pubspec.yaml
+++ b/packages/webview_flutter/webview_flutter/example/pubspec.yaml
@@ -19,10 +19,10 @@
 
 dev_dependencies:
   espresso: ^0.1.0+2
-  flutter_test:
-    sdk: flutter
   flutter_driver:
     sdk: flutter
+  flutter_test:
+    sdk: flutter
   integration_test:
     sdk: flutter
   pedantic: ^1.10.0
diff --git a/packages/webview_flutter/webview_flutter/lib/src/webview.dart b/packages/webview_flutter/webview_flutter/lib/src/webview.dart
index 61702e5..b24020b 100644
--- a/packages/webview_flutter/webview_flutter/lib/src/webview.dart
+++ b/packages/webview_flutter/webview_flutter/lib/src/webview.dart
@@ -15,7 +15,7 @@
 
 /// Optional callback invoked when a web view is first created. [controller] is
 /// the [WebViewController] for the created web view.
-typedef void WebViewCreatedCallback(WebViewController controller);
+typedef WebViewCreatedCallback = void Function(WebViewController controller);
 
 /// Information about a navigation action that is about to be executed.
 class NavigationRequest {
@@ -29,7 +29,7 @@
 
   @override
   String toString() {
-    return '$runtimeType(url: $url, isForMainFrame: $isForMainFrame)';
+    return 'NavigationRequest(url: $url, isForMainFrame: $isForMainFrame)';
   }
 }
 
@@ -48,20 +48,20 @@
 /// `navigation` should be handled.
 ///
 /// See also: [WebView.navigationDelegate].
-typedef FutureOr<NavigationDecision> NavigationDelegate(
+typedef NavigationDelegate = FutureOr<NavigationDecision> Function(
     NavigationRequest navigation);
 
 /// Signature for when a [WebView] has started loading a page.
-typedef void PageStartedCallback(String url);
+typedef PageStartedCallback = void Function(String url);
 
 /// Signature for when a [WebView] has finished loading a page.
-typedef void PageFinishedCallback(String url);
+typedef PageFinishedCallback = void Function(String url);
 
 /// Signature for when a [WebView] is loading a page.
-typedef void PageLoadingCallback(int progress);
+typedef PageLoadingCallback = void Function(int progress);
 
 /// Signature for when a [WebView] has failed to load a resource.
-typedef void WebResourceErrorCallback(WebResourceError error);
+typedef WebResourceErrorCallback = void Function(WebResourceError error);
 
 /// A web view widget for showing html content.
 ///
@@ -391,7 +391,7 @@
   bool? hasNavigationDelegate;
   bool? hasProgressTracking;
   bool? debuggingEnabled;
-  WebSetting<String?> userAgent = WebSetting.absent();
+  WebSetting<String?> userAgent = const WebSetting<String?>.absent();
   bool? zoomEnabled;
   if (currentValue.javascriptMode != newValue.javascriptMode) {
     javascriptMode = newValue.javascriptMode;
@@ -468,6 +468,7 @@
     }
   }
 
+  @override
   void onWebResourceError(WebResourceError error) {
     if (_widget.onWebResourceError != null) {
       _widget.onWebResourceError!(error);
diff --git a/packages/webview_flutter/webview_flutter/pubspec.yaml b/packages/webview_flutter/webview_flutter/pubspec.yaml
index 4450837..23693f3 100644
--- a/packages/webview_flutter/webview_flutter/pubspec.yaml
+++ b/packages/webview_flutter/webview_flutter/pubspec.yaml
@@ -19,9 +19,9 @@
 dependencies:
   flutter:
     sdk: flutter
-  webview_flutter_android: ^2.2.0
-  webview_flutter_platform_interface: ^1.2.0
-  webview_flutter_wkwebview: ^2.2.0
+  webview_flutter_android: ^2.3.1
+  webview_flutter_platform_interface: ^1.5.2
+  webview_flutter_wkwebview: ^2.4.0
 
 dev_dependencies:
   build_runner: ^2.1.5
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 69d4142..f8a9e33 100644
--- a/packages/webview_flutter/webview_flutter/test/webview_flutter_test.dart
+++ b/packages/webview_flutter/webview_flutter/test/webview_flutter_test.dart
@@ -13,9 +13,9 @@
 
 import 'webview_flutter_test.mocks.dart';
 
-typedef void VoidCallback();
+typedef VoidCallback = void Function();
 
-@GenerateMocks([WebViewPlatform, WebViewPlatformController])
+@GenerateMocks(<Type>[WebViewPlatform, WebViewPlatformController])
 void main() {
   TestWidgetsFlutterBinding.ensureInitialized();
 
@@ -35,7 +35,8 @@
       gestureRecognizers: anyNamed('gestureRecognizers'),
     )).thenAnswer((Invocation invocation) {
       final WebViewPlatformCreatedCallback onWebViewPlatformCreated =
-          invocation.namedArguments[Symbol('onWebViewPlatformCreated')];
+          invocation.namedArguments[const Symbol('onWebViewPlatformCreated')]
+              as WebViewPlatformCreatedCallback;
       return TestPlatformWebView(
         mockWebViewPlatformController: mockWebViewPlatformController,
         onWebViewPlatformCreated: onWebViewPlatformCreated,
@@ -50,12 +51,12 @@
   });
 
   testWidgets('Initial url', (WidgetTester tester) async {
-    await tester.pumpWidget(WebView(initialUrl: 'https://youtube.com'));
+    await tester.pumpWidget(const WebView(initialUrl: 'https://youtube.com'));
 
     final CreationParams params = captureBuildArgs(
       mockWebViewPlatform,
       creationParams: true,
-    ).single;
+    ).single as CreationParams;
 
     expect(params.initialUrl, 'https://youtube.com');
   });
@@ -68,7 +69,7 @@
     final CreationParams unrestrictedparams = captureBuildArgs(
       mockWebViewPlatform,
       creationParams: true,
-    ).single;
+    ).single as CreationParams;
 
     expect(
       unrestrictedparams.webSettings!.javascriptMode,
@@ -82,7 +83,7 @@
     final CreationParams disabledparams = captureBuildArgs(
       mockWebViewPlatform,
       creationParams: true,
-    ).single;
+    ).single as CreationParams;
 
     expect(disabledparams.webSettings!.javascriptMode, JavascriptMode.disabled);
   });
@@ -122,7 +123,7 @@
     final CreationParams params = captureBuildArgs(
       mockWebViewPlatform,
       creationParams: true,
-    ).single;
+    ).single as CreationParams;
 
     expect(params.initialUrl, isNull);
 
@@ -153,7 +154,7 @@
     ));
   });
 
-  testWidgets("Clear Cache", (WidgetTester tester) async {
+  testWidgets('Clear Cache', (WidgetTester tester) async {
     WebViewController? controller;
     await tester.pumpWidget(
       WebView(
@@ -410,7 +411,7 @@
     final CreationParams params = captureBuildArgs(
       mockWebViewPlatform,
       creationParams: true,
-    ).single;
+    ).single as CreationParams;
 
     expect(params.javascriptChannelNames,
         unorderedEquals(<String>['Tts', 'Alarm']));
@@ -479,7 +480,7 @@
     final JavascriptChannelRegistry channelRegistry = captureBuildArgs(
       mockWebViewPlatform,
       javascriptChannelRegistry: true,
-    ).first;
+    ).first as JavascriptChannelRegistry;
 
     expect(
       channelRegistry.channels.keys,
@@ -522,7 +523,7 @@
     final JavascriptChannelRegistry channelRegistry = captureBuildArgs(
       mockWebViewPlatform,
       javascriptChannelRegistry: true,
-    ).last;
+    ).last as JavascriptChannelRegistry;
 
     expect(channelRegistry.channels.keys, unorderedEquals(<String>['Tts']));
   });
@@ -551,7 +552,7 @@
     final JavascriptChannelRegistry channelRegistry = captureBuildArgs(
       mockWebViewPlatform,
       javascriptChannelRegistry: true,
-    ).single;
+    ).single as JavascriptChannelRegistry;
 
     expect(ttsMessagesReceived, isEmpty);
     expect(alarmMessagesReceived, isEmpty);
@@ -576,7 +577,7 @@
       final WebViewPlatformCallbacksHandler handler = captureBuildArgs(
         mockWebViewPlatform,
         webViewPlatformCallbacksHandler: true,
-      ).single;
+      ).single as WebViewPlatformCallbacksHandler;
 
       handler.onPageStarted('https://youtube.com');
 
@@ -592,7 +593,7 @@
       final WebViewPlatformCallbacksHandler handler = captureBuildArgs(
         mockWebViewPlatform,
         webViewPlatformCallbacksHandler: true,
-      ).single;
+      ).single as WebViewPlatformCallbacksHandler;
 
       // The platform side will always invoke a call for onPageStarted. This is
       // to test that it does not crash on a null callback.
@@ -617,7 +618,7 @@
       final WebViewPlatformCallbacksHandler handler = captureBuildArgs(
         mockWebViewPlatform,
         webViewPlatformCallbacksHandler: true,
-      ).last;
+      ).last as WebViewPlatformCallbacksHandler;
       handler.onPageStarted('https://youtube.com');
 
       expect(returnedUrl, 'https://youtube.com');
@@ -638,7 +639,7 @@
       final WebViewPlatformCallbacksHandler handler = captureBuildArgs(
         mockWebViewPlatform,
         webViewPlatformCallbacksHandler: true,
-      ).single;
+      ).single as WebViewPlatformCallbacksHandler;
       handler.onPageFinished('https://youtube.com');
 
       expect(returnedUrl, 'https://youtube.com');
@@ -653,7 +654,7 @@
       final WebViewPlatformCallbacksHandler handler = captureBuildArgs(
         mockWebViewPlatform,
         webViewPlatformCallbacksHandler: true,
-      ).single;
+      ).single as WebViewPlatformCallbacksHandler;
       // The platform side will always invoke a call for onPageFinished. This is
       // to test that it does not crash on a null callback.
       handler.onPageFinished('https://youtube.com');
@@ -677,7 +678,7 @@
       final WebViewPlatformCallbacksHandler handler = captureBuildArgs(
         mockWebViewPlatform,
         webViewPlatformCallbacksHandler: true,
-      ).last;
+      ).last as WebViewPlatformCallbacksHandler;
       handler.onPageFinished('https://youtube.com');
 
       expect(returnedUrl, 'https://youtube.com');
@@ -698,7 +699,7 @@
       final WebViewPlatformCallbacksHandler handler = captureBuildArgs(
         mockWebViewPlatform,
         webViewPlatformCallbacksHandler: true,
-      ).single;
+      ).single as WebViewPlatformCallbacksHandler;
       handler.onProgress(50);
 
       expect(loadingProgress, 50);
@@ -713,7 +714,7 @@
       final WebViewPlatformCallbacksHandler handler = captureBuildArgs(
         mockWebViewPlatform,
         webViewPlatformCallbacksHandler: true,
-      ).single;
+      ).single as WebViewPlatformCallbacksHandler;
 
       // This is to test that it does not crash on a null callback.
       handler.onProgress(50);
@@ -737,7 +738,7 @@
       final WebViewPlatformCallbacksHandler handler = captureBuildArgs(
         mockWebViewPlatform,
         webViewPlatformCallbacksHandler: true,
-      ).last;
+      ).last as WebViewPlatformCallbacksHandler;
       handler.onProgress(50);
 
       expect(loadingProgress, 50);
@@ -753,7 +754,7 @@
       final CreationParams params = captureBuildArgs(
         mockWebViewPlatform,
         creationParams: true,
-      ).single;
+      ).single as CreationParams;
 
       expect(params.webSettings!.hasNavigationDelegate, false);
 
@@ -766,7 +767,7 @@
       final WebSettings updateSettings =
           verify(mockWebViewPlatformController.updateSettings(captureAny))
               .captured
-              .single;
+              .single as WebSettings;
 
       expect(updateSettings.hasNavigationDelegate, true);
     });
@@ -790,10 +791,11 @@
         webViewPlatformCallbacksHandler: true,
       );
 
-      final CreationParams params = args[0];
+      final CreationParams params = args[0] as CreationParams;
       expect(params.webSettings!.hasNavigationDelegate, true);
 
-      final WebViewPlatformCallbacksHandler handler = args[1];
+      final WebViewPlatformCallbacksHandler handler =
+          args[1] as WebViewPlatformCallbacksHandler;
 
       // The navigation delegate only allows navigation to https://flutter.dev
       // so we should still be in https://youtube.com.
@@ -828,7 +830,7 @@
       final CreationParams params = captureBuildArgs(
         mockWebViewPlatform,
         creationParams: true,
-      ).single;
+      ).single as CreationParams;
 
       expect(params.webSettings!.debuggingEnabled, true);
     });
@@ -839,7 +841,7 @@
       final CreationParams params = captureBuildArgs(
         mockWebViewPlatform,
         creationParams: true,
-      ).single;
+      ).single as CreationParams;
 
       expect(params.webSettings!.debuggingEnabled, false);
     });
@@ -856,7 +858,7 @@
       final WebSettings enabledSettings =
           verify(mockWebViewPlatformController.updateSettings(captureAny))
               .captured
-              .last;
+              .last as WebSettings;
       expect(enabledSettings.debuggingEnabled, true);
 
       await tester.pumpWidget(WebView(
@@ -867,7 +869,7 @@
       final WebSettings disabledSettings =
           verify(mockWebViewPlatformController.updateSettings(captureAny))
               .captured
-              .last;
+              .last as WebSettings;
       expect(disabledSettings.debuggingEnabled, false);
     });
   });
@@ -881,7 +883,7 @@
       final CreationParams params = captureBuildArgs(
         mockWebViewPlatform,
         creationParams: true,
-      ).single;
+      ).single as CreationParams;
 
       expect(params.webSettings!.zoomEnabled, isTrue);
     });
@@ -892,7 +894,7 @@
       final CreationParams params = captureBuildArgs(
         mockWebViewPlatform,
         creationParams: true,
-      ).single;
+      ).single as CreationParams;
 
       expect(params.webSettings!.zoomEnabled, isTrue);
     });
@@ -909,7 +911,7 @@
       final WebSettings enabledSettings =
           verify(mockWebViewPlatformController.updateSettings(captureAny))
               .captured
-              .last;
+              .last as WebSettings;
       // Zoom defaults to true, so no changes are made to settings.
       expect(enabledSettings.zoomEnabled, isNull);
 
@@ -921,7 +923,7 @@
       final WebSettings disabledSettings =
           verify(mockWebViewPlatformController.updateSettings(captureAny))
               .captured
-              .last;
+              .last as WebSettings;
       expect(disabledSettings.zoomEnabled, isFalse);
     });
   });
@@ -953,7 +955,7 @@
               javascriptMode: JavascriptMode.disabled,
               hasNavigationDelegate: false,
               debuggingEnabled: false,
-              userAgent: WebSetting<String?>.of(null),
+              userAgent: const WebSetting<String?>.of(null),
               gestureNavigationEnabled: true,
               zoomEnabled: true,
             ),
@@ -994,7 +996,7 @@
     final CreationParams params = captureBuildArgs(
       mockWebViewPlatform,
       creationParams: true,
-    ).single;
+    ).single as CreationParams;
 
     expect(params.webSettings!.userAgent.value, isNull);
 
@@ -1007,7 +1009,7 @@
     final WebSettings settings =
         verify(mockWebViewPlatformController.updateSettings(captureAny))
             .captured
-            .last;
+            .last as WebSettings;
     expect(settings.userAgent.value, 'UA');
   });
 }
@@ -1062,7 +1064,7 @@
   @override
   void initState() {
     super.initState();
-    WebViewPlatformCreatedCallback? onWebViewPlatformCreated =
+    final WebViewPlatformCreatedCallback? onWebViewPlatformCreated =
         widget.onWebViewPlatformCreated;
     if (onWebViewPlatformCreated != null) {
       onWebViewPlatformCreated(widget.mockWebViewPlatformController);
diff --git a/script/configs/custom_analysis.yaml b/script/configs/custom_analysis.yaml
index 820a06a..c1c4a8d 100644
--- a/script/configs/custom_analysis.yaml
+++ b/script/configs/custom_analysis.yaml
@@ -23,7 +23,6 @@
 - ios_platform_images
 - local_auth
 - video_player
-- webview_flutter/webview_flutter
 
 # These plugins are deprecated in favor of the Community Plus versions, and
 # will be removed from the repo once the critical support window has passed,