From 1bbd61f8d49801eb8342e9385f76bf7aab316a7f Mon Sep 17 00:00:00 2001 From: Paul Staats Date: Tue, 2 May 2023 10:33:54 +0200 Subject: [PATCH 01/35] Added fullscreen capabilities to the android webview --- .../webview_flutter_android/CHANGELOG.md | 4 + .../WebChromeClientHostApiImpl.java | 102 +++++++++++++++++- .../webviewflutter/WebViewFlutterPlugin.java | 15 ++- .../webviewflutter/WebChromeClientTest.java | 34 +++++- .../webview_flutter_android/pubspec.yaml | 2 +- 5 files changed, 144 insertions(+), 13 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md index 82dbbd49f215..62939d468d35 100644 --- a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md @@ -1,3 +1,7 @@ +## 3.7.0 + +* Adds support for fullscreen video. + ## 3.6.3 * Updates gradle, AGP and fixes some lint errors. diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java index 38ebcb8932b8..b68e30327bb8 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java @@ -4,15 +4,25 @@ package io.flutter.plugins.webviewflutter; +import android.app.Activity; +import android.content.Context; import android.net.Uri; import android.os.Build; import android.os.Message; +import android.view.Gravity; +import android.view.View; +import android.view.ViewGroup; +import android.view.Window; +import android.view.WindowInsets; +import android.view.WindowManager; import android.webkit.PermissionRequest; import android.webkit.ValueCallback; import android.webkit.WebChromeClient; import android.webkit.WebResourceRequest; import android.webkit.WebView; import android.webkit.WebViewClient; +import android.widget.FrameLayout; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.RequiresApi; @@ -29,6 +39,7 @@ public class WebChromeClientHostApiImpl implements WebChromeClientHostApi { private final InstanceManager instanceManager; private final WebChromeClientCreator webChromeClientCreator; private final WebChromeClientFlutterApiImpl flutterApi; + private Context context; /** * Implementation of {@link WebChromeClient} that passes arguments of callback methods to Dart. @@ -36,14 +47,18 @@ public class WebChromeClientHostApiImpl implements WebChromeClientHostApi { public static class WebChromeClientImpl extends SecureWebChromeClient { private final WebChromeClientFlutterApiImpl flutterApi; private boolean returnValueForOnShowFileChooser = false; + private View mFullscreenView; + private Context context; /** * Creates a {@link WebChromeClient} that passes arguments of callbacks methods to Dart. * * @param flutterApi handles sending messages to Dart + * @param context the Activity or application context */ - public WebChromeClientImpl(@NonNull WebChromeClientFlutterApiImpl flutterApi) { + public WebChromeClientImpl(@NonNull WebChromeClientFlutterApiImpl flutterApi, Context context) { this.flutterApi = flutterApi; + this.context = context; } @Override @@ -51,6 +66,67 @@ public void onProgressChanged(@NonNull WebView view, int progress) { flutterApi.onProgressChanged(this, view, (long) progress, reply -> {}); } + @Override + public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) { + if (mFullscreenView != null) { + ((ViewGroup) mFullscreenView.getParent()).removeView(mFullscreenView); + } + if (context instanceof Activity) { + Window window = ((Activity)context).getWindow(); + mFullscreenView = view; + setFullscreenStatus(true, window); + window.addContentView(mFullscreenView, + new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT, Gravity.CENTER)); + } + } + + @Override + public void onHideCustomView() { + if (mFullscreenView == null) { + return; + } + if (context instanceof Activity) { + setFullscreenStatus(false, ((Activity)context).getWindow()); + ((ViewGroup) mFullscreenView.getParent()).removeView(mFullscreenView); + mFullscreenView = null; + } + } + + @SuppressWarnings("deprecation") + void activateFullscreenDeprecated(Boolean fullscreen, Window window) { + View decorView = window.getDecorView(); + if (fullscreen) { + decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN); + + window.addFlags( + WindowManager.LayoutParams.FLAG_FULLSCREEN); + } else { + decorView.setSystemUiVisibility(View.STATUS_BAR_VISIBLE); + + window.clearFlags( + WindowManager.LayoutParams.FLAG_FULLSCREEN); + } + } + + @RequiresApi(api = Build.VERSION_CODES.R) // >= 30 + void setFullScreenCurrent(Boolean fullscreen, Window window) { + View decorView = window.getDecorView(); + if (fullscreen) { + decorView.getWindowInsetsController().hide(WindowInsets.Type.statusBars()); + } else { + decorView.getWindowInsetsController().show(WindowInsets.Type.statusBars()); + } + } + + void setFullscreenStatus(Boolean fullscreen, Window window) { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) { + activateFullscreenDeprecated(fullscreen, window); + } else { + setFullScreenCurrent(fullscreen, window); + } + } + @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @SuppressWarnings("LambdaLast") @Override @@ -87,6 +163,11 @@ public void onPermissionRequest(@NonNull PermissionRequest request) { public void setReturnValueForOnShowFileChooser(boolean value) { returnValueForOnShowFileChooser = value; } + + @VisibleForTesting + public View getmFullscreenView() { + return this.mFullscreenView; + } } /** @@ -183,12 +264,13 @@ public static class WebChromeClientCreator { * Creates a {@link WebChromeClientHostApiImpl.WebChromeClientImpl}. * * @param flutterApi handles sending messages to Dart + * @param context the Activity or application context * @return the created {@link WebChromeClientHostApiImpl.WebChromeClientImpl} */ @NonNull public WebChromeClientImpl createWebChromeClient( - @NonNull WebChromeClientFlutterApiImpl flutterApi) { - return new WebChromeClientImpl(flutterApi); + @NonNull WebChromeClientFlutterApiImpl flutterApi, Context context) { + return new WebChromeClientImpl(flutterApi, context); } } @@ -202,16 +284,26 @@ public WebChromeClientImpl createWebChromeClient( public WebChromeClientHostApiImpl( @NonNull InstanceManager instanceManager, @NonNull WebChromeClientCreator webChromeClientCreator, - @NonNull WebChromeClientFlutterApiImpl flutterApi) { + @NonNull WebChromeClientFlutterApiImpl flutterApi, + @NonNull Context context) { this.instanceManager = instanceManager; this.webChromeClientCreator = webChromeClientCreator; this.flutterApi = flutterApi; + this.context = context; + } + + /** + * Sets the context to construct {@link WebChromeClientImpl}s. + * @param context the new context + */ + public void setContext(Context context) { + this.context = context; } @Override public void create(@NonNull Long instanceId) { final WebChromeClient webChromeClient = - webChromeClientCreator.createWebChromeClient(flutterApi); + webChromeClientCreator.createWebChromeClient(flutterApi, context); instanceManager.addDartCreatedInstance(webChromeClient, instanceId); } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java index af34649211ab..53215b899923 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java @@ -40,6 +40,7 @@ public class WebViewFlutterPlugin implements FlutterPlugin, ActivityAware { private FlutterPluginBinding pluginBinding; private WebViewHostApiImpl webViewHostApi; private JavaScriptChannelHostApiImpl javaScriptChannelHostApi; + private WebChromeClientHostApiImpl webChromeClientHostApi; /** * Add an instance of this to {@link io.flutter.embedding.engine.plugins.PluginRegistry} to @@ -100,6 +101,14 @@ private void setUp( new JavaScriptChannelFlutterApiImpl(binaryMessenger, instanceManager), new Handler(context.getMainLooper())); + webChromeClientHostApi = + new WebChromeClientHostApiImpl( + instanceManager, + new WebChromeClientHostApiImpl.WebChromeClientCreator(), + new WebChromeClientFlutterApiImpl(binaryMessenger, instanceManager), + context); + + JavaObjectHostApi.setup(binaryMessenger, new JavaObjectHostApiImpl(instanceManager)); WebViewHostApi.setup(binaryMessenger, webViewHostApi); JavaScriptChannelHostApi.setup(binaryMessenger, javaScriptChannelHostApi); @@ -111,10 +120,7 @@ private void setUp( new WebViewClientFlutterApiImpl(binaryMessenger, instanceManager))); WebChromeClientHostApi.setup( binaryMessenger, - new WebChromeClientHostApiImpl( - instanceManager, - new WebChromeClientHostApiImpl.WebChromeClientCreator(), - new WebChromeClientFlutterApiImpl(binaryMessenger, instanceManager))); + webChromeClientHostApi); DownloadListenerHostApi.setup( binaryMessenger, new DownloadListenerHostApiImpl( @@ -181,6 +187,7 @@ public void onDetachedFromActivity() { private void updateContext(Context context) { webViewHostApi.setContext(context); javaScriptChannelHostApi.setPlatformThreadHandler(new Handler(context.getMainLooper())); + webChromeClientHostApi.setContext(context); } /** Maintains instances used to communicate with the corresponding objects in Dart. */ diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java index 9a97cd6f37a6..fff9906cd462 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java @@ -5,6 +5,7 @@ package io.flutter.plugins.webviewflutter; import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; @@ -13,8 +14,11 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import android.app.Activity; +import android.content.Context; import android.net.Uri; import android.os.Message; +import android.view.Window; import android.webkit.PermissionRequest; import android.webkit.WebResourceRequest; import android.webkit.WebView; @@ -41,6 +45,12 @@ public class WebChromeClientTest { @Mock public WebViewClient mockWebViewClient; + @Mock public Context mockContext; + + @Mock public Activity mockActivity; + + @Mock public Window mockWindow; + InstanceManager instanceManager; WebChromeClientHostApiImpl hostApiImpl; WebChromeClientImpl webChromeClient; @@ -54,15 +64,20 @@ public void setUp() { @Override @NonNull public WebChromeClientImpl createWebChromeClient( - @NonNull WebChromeClientFlutterApiImpl flutterApi) { - webChromeClient = super.createWebChromeClient(flutterApi); + @NonNull WebChromeClientFlutterApiImpl flutterApi, @NonNull Context context) { + webChromeClient = super.createWebChromeClient(flutterApi, context); return webChromeClient; } }; hostApiImpl = - new WebChromeClientHostApiImpl(instanceManager, webChromeClientCreator, mockFlutterApi); + new WebChromeClientHostApiImpl(instanceManager, webChromeClientCreator, mockFlutterApi, mockContext); + hostApiImpl.setContext(mockActivity); hostApiImpl.create(2L); + + when(mockActivity.getWindow()).thenReturn(mockWindow); + when(mockWebView.getParent()).thenReturn(mockWebView); + when(mockWindow.getDecorView()).thenReturn(mockWebView); } @After @@ -124,5 +139,18 @@ public void onPermissionRequest() { webChromeClient.onPermissionRequest(mockRequest); verify(mockFlutterApi).onPermissionRequest(eq(webChromeClient), eq(mockRequest), any()); + } + + @Test + public void onShowCustomView() { + webChromeClient.onShowCustomView(mockWebView, null); + assertNotNull(webChromeClient.getmFullscreenView()); + } + + @Test + public void onHideCustomView() { + webChromeClient.onShowCustomView(mockWebView, null); + webChromeClient.onHideCustomView(); + assertNull(webChromeClient.getmFullscreenView()); } } diff --git a/packages/webview_flutter/webview_flutter_android/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/pubspec.yaml index d9053493cd93..b674a5a6b645 100644 --- a/packages/webview_flutter/webview_flutter_android/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_android/pubspec.yaml @@ -2,7 +2,7 @@ name: webview_flutter_android description: A Flutter plugin that provides a WebView widget on Android. repository: https://github.com/flutter/packages/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: 3.6.3 +version: 3.7.0 environment: sdk: ">=2.18.0 <4.0.0" From 279a678d19a200ebbf62c633d9612c33783a4a18 Mon Sep 17 00:00:00 2001 From: Paul Staats Date: Tue, 2 May 2023 11:32:44 +0200 Subject: [PATCH 02/35] Fixed the formatting --- .../WebChromeClientHostApiImpl.java | 34 ++++++++++--------- .../webviewflutter/WebViewFlutterPlugin.java | 5 +-- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java index b68e30327bb8..454117875f1a 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java @@ -72,25 +72,28 @@ public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callb ((ViewGroup) mFullscreenView.getParent()).removeView(mFullscreenView); } if (context instanceof Activity) { - Window window = ((Activity)context).getWindow(); + Window window = ((Activity) context).getWindow(); mFullscreenView = view; setFullscreenStatus(true, window); - window.addContentView(mFullscreenView, - new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, - ViewGroup.LayoutParams.MATCH_PARENT, Gravity.CENTER)); + window.addContentView( + mFullscreenView, + new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT, + Gravity.CENTER)); } } @Override public void onHideCustomView() { - if (mFullscreenView == null) { - return; - } - if (context instanceof Activity) { - setFullscreenStatus(false, ((Activity)context).getWindow()); - ((ViewGroup) mFullscreenView.getParent()).removeView(mFullscreenView); - mFullscreenView = null; - } + if (mFullscreenView == null) { + return; + } + if (context instanceof Activity) { + setFullscreenStatus(false, ((Activity) context).getWindow()); + ((ViewGroup) mFullscreenView.getParent()).removeView(mFullscreenView); + mFullscreenView = null; + } } @SuppressWarnings("deprecation") @@ -99,13 +102,11 @@ void activateFullscreenDeprecated(Boolean fullscreen, Window window) { if (fullscreen) { decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN); - window.addFlags( - WindowManager.LayoutParams.FLAG_FULLSCREEN); + window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); } else { decorView.setSystemUiVisibility(View.STATUS_BAR_VISIBLE); - window.clearFlags( - WindowManager.LayoutParams.FLAG_FULLSCREEN); + window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); } } @@ -294,6 +295,7 @@ public WebChromeClientHostApiImpl( /** * Sets the context to construct {@link WebChromeClientImpl}s. + * * @param context the new context */ public void setContext(Context context) { diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java index 53215b899923..d8a5a5cee89f 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java @@ -107,7 +107,6 @@ private void setUp( new WebChromeClientHostApiImpl.WebChromeClientCreator(), new WebChromeClientFlutterApiImpl(binaryMessenger, instanceManager), context); - JavaObjectHostApi.setup(binaryMessenger, new JavaObjectHostApiImpl(instanceManager)); WebViewHostApi.setup(binaryMessenger, webViewHostApi); @@ -118,9 +117,7 @@ private void setUp( instanceManager, new WebViewClientHostApiImpl.WebViewClientCreator(), new WebViewClientFlutterApiImpl(binaryMessenger, instanceManager))); - WebChromeClientHostApi.setup( - binaryMessenger, - webChromeClientHostApi); + WebChromeClientHostApi.setup(binaryMessenger, webChromeClientHostApi); DownloadListenerHostApi.setup( binaryMessenger, new DownloadListenerHostApiImpl( From 6649aa8dbeb210987d7a50509ad933d2bbdcbb7b Mon Sep 17 00:00:00 2001 From: Paul Staats Date: Tue, 2 May 2023 11:43:39 +0200 Subject: [PATCH 03/35] Fixed some more formatting + added a nonnull --- .../plugins/webviewflutter/WebChromeClientHostApiImpl.java | 2 +- .../flutter/plugins/webviewflutter/WebChromeClientTest.java | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java index 454117875f1a..974ff18ae81d 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java @@ -270,7 +270,7 @@ public static class WebChromeClientCreator { */ @NonNull public WebChromeClientImpl createWebChromeClient( - @NonNull WebChromeClientFlutterApiImpl flutterApi, Context context) { + @NonNull WebChromeClientFlutterApiImpl flutterApi, @NonNull Context context) { return new WebChromeClientImpl(flutterApi, context); } } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java index fff9906cd462..74279ba59bf1 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java @@ -71,7 +71,8 @@ public WebChromeClientImpl createWebChromeClient( }; hostApiImpl = - new WebChromeClientHostApiImpl(instanceManager, webChromeClientCreator, mockFlutterApi, mockContext); + new WebChromeClientHostApiImpl( + instanceManager, webChromeClientCreator, mockFlutterApi, mockContext); hostApiImpl.setContext(mockActivity); hostApiImpl.create(2L); @@ -139,7 +140,7 @@ public void onPermissionRequest() { webChromeClient.onPermissionRequest(mockRequest); verify(mockFlutterApi).onPermissionRequest(eq(webChromeClient), eq(mockRequest), any()); - } + } @Test public void onShowCustomView() { From fbc3f57c9b91cc0c18d5b32e01c1bd0064c6c8de Mon Sep 17 00:00:00 2001 From: Paul Staats Date: Tue, 2 May 2023 12:12:33 +0200 Subject: [PATCH 04/35] Removed empty line --- .../plugins/webviewflutter/WebChromeClientHostApiImpl.java | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java index 974ff18ae81d..8e0e3886e52f 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java @@ -22,7 +22,6 @@ import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.FrameLayout; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.RequiresApi; From 06935c934be96f444060a5f94f1fc83927627fab Mon Sep 17 00:00:00 2001 From: Paul Staats Date: Tue, 2 May 2023 12:20:40 +0200 Subject: [PATCH 05/35] Adjusted another nonnull --- .../plugins/webviewflutter/WebChromeClientHostApiImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java index 8e0e3886e52f..484e9380bc5d 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java @@ -55,7 +55,8 @@ public static class WebChromeClientImpl extends SecureWebChromeClient { * @param flutterApi handles sending messages to Dart * @param context the Activity or application context */ - public WebChromeClientImpl(@NonNull WebChromeClientFlutterApiImpl flutterApi, Context context) { + public WebChromeClientImpl( + @NonNull WebChromeClientFlutterApiImpl flutterApi, @NonNull Context context) { this.flutterApi = flutterApi; this.context = context; } From ff9137f8634ba939efb2280caba555c1e24e3e24 Mon Sep 17 00:00:00 2001 From: Paul Staats Date: Tue, 2 May 2023 13:15:03 +0200 Subject: [PATCH 06/35] Fixed two lint warnings --- .../webviewflutter/WebChromeClientHostApiImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java index 484e9380bc5d..9b9703739eb9 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java @@ -165,6 +165,12 @@ public void setReturnValueForOnShowFileChooser(boolean value) { returnValueForOnShowFileChooser = value; } + /** + * Returns the fullscreen view + * + * @return View + */ + @Nullable @VisibleForTesting public View getmFullscreenView() { return this.mFullscreenView; @@ -298,7 +304,7 @@ public WebChromeClientHostApiImpl( * * @param context the new context */ - public void setContext(Context context) { + public void setContext(@NonNull Context context) { this.context = context; } From bef6c2a9292a9b4a668ac77a257be732039e05b8 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 30 May 2023 11:22:47 -0400 Subject: [PATCH 07/35] customviewcallback dart impl --- .../CustomViewCallbackFlutterApiImpl.java | 77 ++ .../CustomViewCallbackHostApiImpl.java | 98 ++ .../GeneratedAndroidWebView.java | 886 ++++++++---------- .../CustomViewCallbackTest.java | 144 +++ .../lib/src/android_webview.dart | 39 +- .../lib/src/android_webview.g.dart | 81 +- .../lib/src/android_webview_api_impls.dart | 64 ++ .../pigeons/android_webview.dart | 26 + .../webview_flutter_android/pubspec.yaml | 16 + .../test/android_webview_test.dart | 48 + .../test/android_webview_test.mocks.dart | 19 + .../test/test_android_webview.g.dart | 657 +++++-------- 12 files changed, 1221 insertions(+), 934 deletions(-) create mode 100644 packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackFlutterApiImpl.java create mode 100644 packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackHostApiImpl.java create mode 100644 packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CustomViewCallbackTest.java diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackFlutterApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackFlutterApiImpl.java new file mode 100644 index 000000000000..aa5567d706ea --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackFlutterApiImpl.java @@ -0,0 +1,77 @@ + +// 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. + +// TODO(bparrishMines): Remove GenApiImpls from filename or copy classes/methods to your own implementation + +package io.flutter.plugins.webviewflutter; + + +// TODO(bparrishMines): Import native classes +import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.CustomViewCallbackFlutterApi; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; +import io.flutter.plugin.common.BinaryMessenger; +import java.util.Objects; + +/** + * Flutter API implementation for `CustomViewCallback`. + * + *

This class may handle adding native instances that are attached to a Dart instance or passing + * arguments of callbacks methods to a Dart instance. + */ + +public class CustomViewCallbackFlutterApiImpl { + + // To ease adding additional methods, this value is added prematurely. + @SuppressWarnings({"unused", "FieldCanBeLocal"}) + private final BinaryMessenger binaryMessenger; + + private final InstanceManager instanceManager; + private CustomViewCallbackFlutterApi api; + + /** + * Constructs a {@link CustomViewCallbackFlutterApiImpl}. + * + * @param binaryMessenger used to communicate with Dart over asynchronous messages + * @param instanceManager maintains instances stored to communicate with attached Dart objects + */ + public CustomViewCallbackFlutterApiImpl( + @NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { + this.binaryMessenger = binaryMessenger; + this.instanceManager = instanceManager; + api = new CustomViewCallbackFlutterApi(binaryMessenger); + } + + /** + * Stores the `CustomViewCallback` instance and notifies Dart to create and store a new + * `CustomViewCallback` instance that is attached to this one. If `instance` has already been added, + * this method does nothing. + */ + public void create( + @NonNull CustomViewCallback instance, + + @NonNull CustomViewCallbackFlutterApi.Reply callback) { + if (!instanceManager.containsInstance(instance)) { + api.create( + instanceManager.addHostCreatedInstance(instance), + + callback); + } + } + + + + /** + * Sets the Flutter API used to send messages to Dart. + * + *

This is only visible for testing. + */ + @VisibleForTesting + void setApi(@NonNull CustomViewCallbackFlutterApi api) { + this.api = api; + } +} + diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackHostApiImpl.java new file mode 100644 index 000000000000..4f2e0f053bd4 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackHostApiImpl.java @@ -0,0 +1,98 @@ + +// 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. + +// TODO(bparrishMines): Remove GenApiImpls from filename or copy classes/methods to your own implementation + +package io.flutter.plugins.webviewflutter; + + +// TODO(bparrishMines): Import native classes +import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.CustomViewCallbackHostApi; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; +import io.flutter.plugin.common.BinaryMessenger; +import java.util.Objects; + +/** + * Host API implementation for `CustomViewCallback`. + * + *

This class may handle instantiating and adding native object instances that are attached to a + * Dart instance or handle method calls on the associated native class or an instance of the class. + */ + +public class CustomViewCallbackHostApiImpl implements CustomViewCallbackHostApi { + + // To ease adding additional methods, this value is added prematurely. + @SuppressWarnings({"unused", "FieldCanBeLocal"}) + private final BinaryMessenger binaryMessenger; + + private final InstanceManager instanceManager; + + + + + + + /** + * Constructs a {@link CustomViewCallbackHostApiImpl}. + * + * @param binaryMessenger used to communicate with Dart over asynchronous messages + * @param instanceManager maintains instances stored to communicate with attached Dart objects + */ + public CustomViewCallbackHostApiImpl( + @NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { + + this.binaryMessenger = binaryMessenger; + this.instanceManager = instanceManager; + + + } + + + + + + + + + + + + @Override + public void onCustomViewHidden( + @NonNull Long identifier + ) { + + + + getCustomViewCallbackInstance(identifier) + .onCustomViewHidden( + + + + + + ); + + + + + + + + + + + + } + + + + private CustomViewCallback getCustomViewCallbackInstance(@NonNull Long identifier) { + return Objects.requireNonNull(instanceManager.getInstance(identifier)); + } +} + diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java index a9dc42f40103..01e6fa9122a8 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java @@ -1,7 +1,7 @@ // 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. -// Autogenerated from Pigeon (v9.2.4), do not edit directly. +// Autogenerated from Pigeon (v9.2.5), do not edit directly. // See also: https://pub.dev/packages/pigeon package io.flutter.plugins.webviewflutter; @@ -18,6 +18,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -34,7 +35,8 @@ public static class FlutterError extends RuntimeException { /** The error details. Must be a datatype supported by the api codec. */ public final Object details; - public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) { + public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) + { super(message); this.code = code; this.details = details; @@ -53,7 +55,7 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); } return errorList; } @@ -61,29 +63,26 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { /** * Mode of how to select files for a file chooser. * - *

See - * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. + * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. */ public enum FileChooserMode { /** - * Open single file and requires that the file exists before allowing the user to pick it. + * Open single file and requires that the file exists before allowing the + * user to pick it. * - *

See - * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN. + * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN. */ OPEN(0), /** * Similar to [open] but allows multiple files to be selected. * - *

See - * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE. + * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE. */ OPEN_MULTIPLE(1), /** * Allows picking a nonexistent file and saving it. * - *

See - * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE. + * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE. */ SAVE(2); @@ -375,10 +374,7 @@ ArrayList toList() { static @NonNull WebResourceErrorData fromList(@NonNull ArrayList list) { WebResourceErrorData pigeonResult = new WebResourceErrorData(); Object errorCode = list.get(0); - pigeonResult.setErrorCode( - (errorCode == null) - ? null - : ((errorCode instanceof Integer) ? (Integer) errorCode : (Long) errorCode)); + pigeonResult.setErrorCode((errorCode == null) ? null : ((errorCode instanceof Integer) ? (Integer) errorCode : (Long) errorCode)); Object description = list.get(1); pigeonResult.setDescription((String) description); return pigeonResult; @@ -467,13 +463,13 @@ public interface Result { /** * Host API for managing the native `InstanceManager`. * - *

Generated interface from Pigeon that represents a handler of messages from Flutter. + * Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface InstanceManagerHostApi { /** * Clear the native `InstanceManager`. * - *

This is typically only used after a hot restart. + * This is typically only used after a hot restart. */ void clear(); @@ -481,12 +477,8 @@ public interface InstanceManagerHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `InstanceManagerHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable InstanceManagerHostApi api) { + /**Sets up an instance of `InstanceManagerHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable InstanceManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -498,7 +490,8 @@ static void setup( try { api.clear(); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -513,11 +506,11 @@ static void setup( /** * Handles methods calls to the native Java Object class. * - *

Also handles calls to remove the reference to an instance with `dispose`. + * Also handles calls to remove the reference to an instance with `dispose`. * - *

See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. + * See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. * - *

Generated interface from Pigeon that represents a handler of messages from Flutter. + * Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface JavaObjectHostApi { @@ -527,9 +520,7 @@ public interface JavaObjectHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. - */ + /**Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObjectHostApi api) { { BasicMessageChannel channel = @@ -544,7 +535,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObject try { api.dispose((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -559,9 +551,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObject /** * Handles callbacks methods for the native Java Object class. * - *

See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. + * See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. * - *

Generated class from Pigeon that represents Flutter messages that can be called from Java. + * Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class JavaObjectFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -570,7 +562,7 @@ public JavaObjectFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -579,7 +571,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void dispose(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -600,18 +591,12 @@ public interface CookieManagerHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `CookieManagerHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable CookieManagerHostApi api) { + /**Sets up an instance of `CookieManagerHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CookieManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.CookieManagerHostApi.clearCookies", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.CookieManagerHostApi.clearCookies", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -649,7 +634,8 @@ public void error(Throwable error) { try { api.setCookie(urlArg, valueArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -693,32 +679,21 @@ public interface WebViewHostApi { void create(@NonNull Long instanceId); - void loadData( - @NonNull Long instanceId, - @NonNull String data, - @Nullable String mimeType, - @Nullable String encoding); + void loadData(@NonNull Long instanceId, @NonNull String data, @Nullable String mimeType, @Nullable String encoding); - void loadDataWithBaseUrl( - @NonNull Long instanceId, - @Nullable String baseUrl, - @NonNull String data, - @Nullable String mimeType, - @Nullable String encoding, - @Nullable String historyUrl); + void loadDataWithBaseUrl(@NonNull Long instanceId, @Nullable String baseUrl, @NonNull String data, @Nullable String mimeType, @Nullable String encoding, @Nullable String historyUrl); - void loadUrl( - @NonNull Long instanceId, @NonNull String url, @NonNull Map headers); + void loadUrl(@NonNull Long instanceId, @NonNull String url, @NonNull Map headers); void postUrl(@NonNull Long instanceId, @NonNull String url, @NonNull byte[] data); - @Nullable + @Nullable String getUrl(@NonNull Long instanceId); - @NonNull + @NonNull Boolean canGoBack(@NonNull Long instanceId); - @NonNull + @NonNull Boolean canGoForward(@NonNull Long instanceId); void goBack(@NonNull Long instanceId); @@ -729,23 +704,22 @@ void loadUrl( void clearCache(@NonNull Long instanceId, @NonNull Boolean includeDiskFiles); - void evaluateJavascript( - @NonNull Long instanceId, @NonNull String javascriptString, @NonNull Result result); + void evaluateJavascript(@NonNull Long instanceId, @NonNull String javascriptString, @NonNull Result result); - @Nullable + @Nullable String getTitle(@NonNull Long instanceId); void scrollTo(@NonNull Long instanceId, @NonNull Long x, @NonNull Long y); void scrollBy(@NonNull Long instanceId, @NonNull Long x, @NonNull Long y); - @NonNull + @NonNull Long getScrollX(@NonNull Long instanceId); - @NonNull + @NonNull Long getScrollY(@NonNull Long instanceId); - @NonNull + @NonNull WebViewPoint getScrollPosition(@NonNull Long instanceId); void setWebContentsDebuggingEnabled(@NonNull Boolean enabled); @@ -754,8 +728,7 @@ void evaluateJavascript( void addJavaScriptChannel(@NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId); - void removeJavaScriptChannel( - @NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId); + void removeJavaScriptChannel(@NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId); void setDownloadListener(@NonNull Long instanceId, @Nullable Long listenerInstanceId); @@ -767,7 +740,7 @@ void removeJavaScriptChannel( static @NonNull MessageCodec getCodec() { return WebViewHostApiCodec.INSTANCE; } - /** Sets up an instance of `WebViewHostApi` to handle messages through the `binaryMessenger`. */ + /**Sets up an instance of `WebViewHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHostApi api) { { BasicMessageChannel channel = @@ -782,7 +755,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -806,13 +780,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos String mimeTypeArg = (String) args.get(2); String encodingArg = (String) args.get(3); try { - api.loadData( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - dataArg, - mimeTypeArg, - encodingArg); + api.loadData((instanceIdArg == null) ? null : instanceIdArg.longValue(), dataArg, mimeTypeArg, encodingArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -825,9 +796,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -840,15 +809,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos String encodingArg = (String) args.get(4); String historyUrlArg = (String) args.get(5); try { - api.loadDataWithBaseUrl( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - baseUrlArg, - dataArg, - mimeTypeArg, - encodingArg, - historyUrlArg); + api.loadDataWithBaseUrl((instanceIdArg == null) ? null : instanceIdArg.longValue(), baseUrlArg, dataArg, mimeTypeArg, encodingArg, historyUrlArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -871,12 +835,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos String urlArg = (String) args.get(1); Map headersArg = (Map) args.get(2); try { - api.loadUrl( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - urlArg, - headersArg); + api.loadUrl((instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, headersArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -899,10 +861,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos String urlArg = (String) args.get(1); byte[] dataArg = (byte[]) args.get(2); try { - api.postUrl( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, dataArg); + api.postUrl((instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, dataArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -923,10 +885,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - String output = - api.getUrl((instanceIdArg == null) ? null : instanceIdArg.longValue()); + String output = api.getUrl((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -947,10 +909,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - Boolean output = - api.canGoBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); + Boolean output = api.canGoBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -971,10 +933,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - Boolean output = - api.canGoForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); + Boolean output = api.canGoForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -997,7 +959,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos try { api.goBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1020,7 +983,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos try { api.goForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1043,7 +1007,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos try { api.reload((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1065,11 +1030,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos Number instanceIdArg = (Number) args.get(0); Boolean includeDiskFilesArg = (Boolean) args.get(1); try { - api.clearCache( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - includeDiskFilesArg); + api.clearCache((instanceIdArg == null) ? null : instanceIdArg.longValue(), includeDiskFilesArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1082,9 +1046,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.evaluateJavascript", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.evaluateJavascript", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1105,10 +1067,7 @@ public void error(Throwable error) { } }; - api.evaluateJavascript( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - javascriptStringArg, - resultCallback); + api.evaluateJavascript((instanceIdArg == null) ? null : instanceIdArg.longValue(), javascriptStringArg, resultCallback); }); } else { channel.setMessageHandler(null); @@ -1125,10 +1084,10 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - String output = - api.getTitle((instanceIdArg == null) ? null : instanceIdArg.longValue()); + String output = api.getTitle((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1151,12 +1110,10 @@ public void error(Throwable error) { Number xArg = (Number) args.get(1); Number yArg = (Number) args.get(2); try { - api.scrollTo( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (xArg == null) ? null : xArg.longValue(), - (yArg == null) ? null : yArg.longValue()); + api.scrollTo((instanceIdArg == null) ? null : instanceIdArg.longValue(), (xArg == null) ? null : xArg.longValue(), (yArg == null) ? null : yArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1179,12 +1136,10 @@ public void error(Throwable error) { Number xArg = (Number) args.get(1); Number yArg = (Number) args.get(2); try { - api.scrollBy( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (xArg == null) ? null : xArg.longValue(), - (yArg == null) ? null : yArg.longValue()); + api.scrollBy((instanceIdArg == null) ? null : instanceIdArg.longValue(), (xArg == null) ? null : xArg.longValue(), (yArg == null) ? null : yArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1205,10 +1160,10 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - Long output = - api.getScrollX((instanceIdArg == null) ? null : instanceIdArg.longValue()); + Long output = api.getScrollX((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1229,10 +1184,10 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - Long output = - api.getScrollY((instanceIdArg == null) ? null : instanceIdArg.longValue()); + Long output = api.getScrollY((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1253,11 +1208,10 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - WebViewPoint output = - api.getScrollPosition( - (instanceIdArg == null) ? null : instanceIdArg.longValue()); + WebViewPoint output = api.getScrollPosition((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1270,9 +1224,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1282,7 +1234,8 @@ public void error(Throwable error) { try { api.setWebContentsDebuggingEnabled(enabledArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1304,13 +1257,10 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number webViewClientInstanceIdArg = (Number) args.get(1); try { - api.setWebViewClient( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (webViewClientInstanceIdArg == null) - ? null - : webViewClientInstanceIdArg.longValue()); + api.setWebViewClient((instanceIdArg == null) ? null : instanceIdArg.longValue(), (webViewClientInstanceIdArg == null) ? null : webViewClientInstanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1323,9 +1273,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1334,13 +1282,10 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number javaScriptChannelInstanceIdArg = (Number) args.get(1); try { - api.addJavaScriptChannel( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (javaScriptChannelInstanceIdArg == null) - ? null - : javaScriptChannelInstanceIdArg.longValue()); + api.addJavaScriptChannel((instanceIdArg == null) ? null : instanceIdArg.longValue(), (javaScriptChannelInstanceIdArg == null) ? null : javaScriptChannelInstanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1353,9 +1298,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1364,13 +1307,10 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number javaScriptChannelInstanceIdArg = (Number) args.get(1); try { - api.removeJavaScriptChannel( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (javaScriptChannelInstanceIdArg == null) - ? null - : javaScriptChannelInstanceIdArg.longValue()); + api.removeJavaScriptChannel((instanceIdArg == null) ? null : instanceIdArg.longValue(), (javaScriptChannelInstanceIdArg == null) ? null : javaScriptChannelInstanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1383,9 +1323,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.setDownloadListener", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setDownloadListener", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1394,11 +1332,10 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number listenerInstanceIdArg = (Number) args.get(1); try { - api.setDownloadListener( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (listenerInstanceIdArg == null) ? null : listenerInstanceIdArg.longValue()); + api.setDownloadListener((instanceIdArg == null) ? null : instanceIdArg.longValue(), (listenerInstanceIdArg == null) ? null : listenerInstanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1411,9 +1348,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.setWebChromeClient", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setWebChromeClient", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1422,11 +1357,10 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number clientInstanceIdArg = (Number) args.get(1); try { - api.setWebChromeClient( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (clientInstanceIdArg == null) ? null : clientInstanceIdArg.longValue()); + api.setWebChromeClient((instanceIdArg == null) ? null : instanceIdArg.longValue(), (clientInstanceIdArg == null) ? null : clientInstanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1439,9 +1373,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.setBackgroundColor", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setBackgroundColor", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1450,11 +1382,10 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number colorArg = (Number) args.get(1); try { - api.setBackgroundColor( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (colorArg == null) ? null : colorArg.longValue()); + api.setBackgroundColor((instanceIdArg == null) ? null : instanceIdArg.longValue(), (colorArg == null) ? null : colorArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1469,12 +1400,13 @@ public void error(Throwable error) { /** * Flutter API for `WebView`. * - *

This class may handle instantiating and adding Dart instances that are attached to a native - * instance or receiving callback methods from an overridden native class. + * This class may handle instantiating and adding Dart instances that are + * attached to a native instance or receiving callback methods from an + * overridden native class. * - *

See https://developer.android.com/reference/android/webkit/WebView. + * See https://developer.android.com/reference/android/webkit/WebView. * - *

Generated class from Pigeon that represents Flutter messages that can be called from Java. + * Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class WebViewFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -1483,7 +1415,7 @@ public WebViewFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1537,9 +1469,7 @@ public interface WebSettingsHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `WebSettingsHostApi` to handle messages through the `binaryMessenger`. - */ + /**Sets up an instance of `WebSettingsHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSettingsHostApi api) { { BasicMessageChannel channel = @@ -1553,11 +1483,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Number webViewInstanceIdArg = (Number) args.get(1); try { - api.create( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (webViewInstanceIdArg == null) ? null : webViewInstanceIdArg.longValue()); + api.create((instanceIdArg == null) ? null : instanceIdArg.longValue(), (webViewInstanceIdArg == null) ? null : webViewInstanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1570,9 +1499,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1581,10 +1508,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean flagArg = (Boolean) args.get(1); try { - api.setDomStorageEnabled( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); + api.setDomStorageEnabled((instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1597,9 +1524,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1608,10 +1533,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean flagArg = (Boolean) args.get(1); try { - api.setJavaScriptCanOpenWindowsAutomatically( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); + api.setJavaScriptCanOpenWindowsAutomatically((instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1624,9 +1549,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1635,10 +1558,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean supportArg = (Boolean) args.get(1); try { - api.setSupportMultipleWindows( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); + api.setSupportMultipleWindows((instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1651,9 +1574,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1662,10 +1583,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean flagArg = (Boolean) args.get(1); try { - api.setJavaScriptEnabled( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); + api.setJavaScriptEnabled((instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1678,9 +1599,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1689,11 +1608,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); String userAgentStringArg = (String) args.get(1); try { - api.setUserAgentString( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - userAgentStringArg); + api.setUserAgentString((instanceIdArg == null) ? null : instanceIdArg.longValue(), userAgentStringArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1706,9 +1624,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1717,10 +1633,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean requireArg = (Boolean) args.get(1); try { - api.setMediaPlaybackRequiresUserGesture( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), requireArg); + api.setMediaPlaybackRequiresUserGesture((instanceIdArg == null) ? null : instanceIdArg.longValue(), requireArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1733,9 +1649,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1744,10 +1658,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean supportArg = (Boolean) args.get(1); try { - api.setSupportZoom( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); + api.setSupportZoom((instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1760,9 +1674,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1771,10 +1683,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean overviewArg = (Boolean) args.get(1); try { - api.setLoadWithOverviewMode( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), overviewArg); + api.setLoadWithOverviewMode((instanceIdArg == null) ? null : instanceIdArg.longValue(), overviewArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1787,9 +1699,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1798,10 +1708,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean useArg = (Boolean) args.get(1); try { - api.setUseWideViewPort( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), useArg); + api.setUseWideViewPort((instanceIdArg == null) ? null : instanceIdArg.longValue(), useArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1814,9 +1724,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1825,10 +1733,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean enabledArg = (Boolean) args.get(1); try { - api.setDisplayZoomControls( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); + api.setDisplayZoomControls((instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1841,9 +1749,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1852,10 +1758,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean enabledArg = (Boolean) args.get(1); try { - api.setBuiltInZoomControls( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); + api.setBuiltInZoomControls((instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1868,9 +1774,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1879,10 +1783,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean enabledArg = (Boolean) args.get(1); try { - api.setAllowFileAccess( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); + api.setAllowFileAccess((instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1904,11 +1808,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Number textZoomArg = (Number) args.get(1); try { - api.setTextZoom( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (textZoomArg == null) ? null : textZoomArg.longValue()); + api.setTextZoom((instanceIdArg == null) ? null : instanceIdArg.longValue(), (textZoomArg == null) ? null : textZoomArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1929,12 +1832,8 @@ public interface JavaScriptChannelHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `JavaScriptChannelHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable JavaScriptChannelHostApi api) { + /**Sets up an instance of `JavaScriptChannelHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaScriptChannelHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1947,10 +1846,10 @@ static void setup( Number instanceIdArg = (Number) args.get(0); String channelNameArg = (String) args.get(1); try { - api.create( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), channelNameArg); + api.create((instanceIdArg == null) ? null : instanceIdArg.longValue(), channelNameArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1970,7 +1869,7 @@ public JavaScriptChannelFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1979,14 +1878,10 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - - public void postMessage( - @NonNull Long instanceIdArg, @NonNull String messageArg, @NonNull Reply callback) { + public void postMessage(@NonNull Long instanceIdArg, @NonNull String messageArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage", getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, messageArg)), channelReply -> callback.reply(null)); @@ -1997,19 +1892,14 @@ public interface WebViewClientHostApi { void create(@NonNull Long instanceId); - void setSynchronousReturnValueForShouldOverrideUrlLoading( - @NonNull Long instanceId, @NonNull Boolean value); + void setSynchronousReturnValueForShouldOverrideUrlLoading(@NonNull Long instanceId, @NonNull Boolean value); /** The codec used by WebViewClientHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `WebViewClientHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable WebViewClientHostApi api) { + /**Sets up an instance of `WebViewClientHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewClientHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2023,7 +1913,8 @@ static void setup( try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2036,9 +1927,7 @@ static void setup( { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2047,10 +1936,10 @@ static void setup( Number instanceIdArg = (Number) args.get(0); Boolean valueArg = (Boolean) args.get(1); try { - api.setSynchronousReturnValueForShouldOverrideUrlLoading( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); + api.setSynchronousReturnValueForShouldOverrideUrlLoading((instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2102,7 +1991,7 @@ public WebViewClientFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2111,97 +2000,47 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return WebViewClientFlutterApiCodec.INSTANCE; } - - public void onPageStarted( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull String urlArg, - @NonNull Reply callback) { + public void onPageStarted(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted", getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), channelReply -> callback.reply(null)); } - - public void onPageFinished( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull String urlArg, - @NonNull Reply callback) { + public void onPageFinished(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished", getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), channelReply -> callback.reply(null)); } - - public void onReceivedRequestError( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull WebResourceRequestData requestArg, - @NonNull WebResourceErrorData errorArg, - @NonNull Reply callback) { + public void onReceivedRequestError(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull WebResourceRequestData requestArg, @NonNull WebResourceErrorData errorArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError", getCodec()); channel.send( - new ArrayList( - Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg, errorArg)), + new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg, errorArg)), channelReply -> callback.reply(null)); } - - public void onReceivedError( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull Long errorCodeArg, - @NonNull String descriptionArg, - @NonNull String failingUrlArg, - @NonNull Reply callback) { + public void onReceivedError(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull Long errorCodeArg, @NonNull String descriptionArg, @NonNull String failingUrlArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError", getCodec()); channel.send( - new ArrayList( - Arrays.asList( - instanceIdArg, - webViewInstanceIdArg, - errorCodeArg, - descriptionArg, - failingUrlArg)), + new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, errorCodeArg, descriptionArg, failingUrlArg)), channelReply -> callback.reply(null)); } - - public void requestLoading( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull WebResourceRequestData requestArg, - @NonNull Reply callback) { + public void requestLoading(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull WebResourceRequestData requestArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading", getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg)), channelReply -> callback.reply(null)); } - - public void urlLoading( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull String urlArg, - @NonNull Reply callback) { + public void urlLoading(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading", getCodec()); @@ -2209,21 +2048,12 @@ public void urlLoading( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), channelReply -> callback.reply(null)); } - - public void doUpdateVisitedHistory( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull String urlArg, - @NonNull Boolean isReloadArg, - @NonNull Reply callback) { + public void doUpdateVisitedHistory(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Boolean isReloadArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory", getCodec()); channel.send( - new ArrayList( - Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg, isReloadArg)), + new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg, isReloadArg)), channelReply -> callback.reply(null)); } } @@ -2236,12 +2066,8 @@ public interface DownloadListenerHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `DownloadListenerHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable DownloadListenerHostApi api) { + /**Sets up an instance of `DownloadListenerHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DownloadListenerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2255,7 +2081,8 @@ static void setup( try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2275,7 +2102,7 @@ public DownloadListenerFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2284,29 +2111,12 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - - public void onDownloadStart( - @NonNull Long instanceIdArg, - @NonNull String urlArg, - @NonNull String userAgentArg, - @NonNull String contentDispositionArg, - @NonNull String mimetypeArg, - @NonNull Long contentLengthArg, - @NonNull Reply callback) { + public void onDownloadStart(@NonNull Long instanceIdArg, @NonNull String urlArg, @NonNull String userAgentArg, @NonNull String contentDispositionArg, @NonNull String mimetypeArg, @NonNull Long contentLengthArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart", getCodec()); channel.send( - new ArrayList( - Arrays.asList( - instanceIdArg, - urlArg, - userAgentArg, - contentDispositionArg, - mimetypeArg, - contentLengthArg)), + new ArrayList(Arrays.asList(instanceIdArg, urlArg, userAgentArg, contentDispositionArg, mimetypeArg, contentLengthArg)), channelReply -> callback.reply(null)); } } @@ -2315,19 +2125,14 @@ public interface WebChromeClientHostApi { void create(@NonNull Long instanceId); - void setSynchronousReturnValueForOnShowFileChooser( - @NonNull Long instanceId, @NonNull Boolean value); + void setSynchronousReturnValueForOnShowFileChooser(@NonNull Long instanceId, @NonNull Boolean value); /** The codec used by WebChromeClientHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `WebChromeClientHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeClientHostApi api) { + /**Sets up an instance of `WebChromeClientHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeClientHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2341,7 +2146,8 @@ static void setup( try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2354,9 +2160,7 @@ static void setup( { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2365,10 +2169,10 @@ static void setup( Number instanceIdArg = (Number) args.get(0); Boolean valueArg = (Boolean) args.get(1); try { - api.setSynchronousReturnValueForOnShowFileChooser( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); + api.setSynchronousReturnValueForOnShowFileChooser((instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2383,22 +2187,18 @@ static void setup( /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface FlutterAssetManagerHostApi { - @NonNull + @NonNull List list(@NonNull String path); - @NonNull + @NonNull String getAssetFilePathByName(@NonNull String name); /** The codec used by FlutterAssetManagerHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `FlutterAssetManagerHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable FlutterAssetManagerHostApi api) { + /**Sets up an instance of `FlutterAssetManagerHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable FlutterAssetManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2412,7 +2212,8 @@ static void setup( try { List output = api.list(pathArg); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2425,9 +2226,7 @@ static void setup( { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2437,7 +2236,8 @@ static void setup( try { String output = api.getAssetFilePathByName(nameArg); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2457,7 +2257,7 @@ public WebChromeClientFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2466,35 +2266,20 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - - public void onProgressChanged( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull Long progressArg, - @NonNull Reply callback) { + public void onProgressChanged(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull Long progressArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged", getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, progressArg)), channelReply -> callback.reply(null)); } - - public void onShowFileChooser( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull Long paramsInstanceIdArg, - @NonNull Reply> callback) { + public void onShowFileChooser(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull Long paramsInstanceIdArg, @NonNull Reply> callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser", getCodec()); channel.send( - new ArrayList( - Arrays.asList(instanceIdArg, webViewInstanceIdArg, paramsInstanceIdArg)), + new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, paramsInstanceIdArg)), channelReply -> { @SuppressWarnings("ConstantConditions") List output = (List) channelReply; @@ -2502,15 +2287,10 @@ public void onShowFileChooser( }); } /** Callback to Dart function `WebChromeClient.onPermissionRequest`. */ - public void onPermissionRequest( - @NonNull Long instanceIdArg, - @NonNull Long requestInstanceIdArg, - @NonNull Reply callback) { + public void onPermissionRequest(@NonNull Long instanceIdArg, @NonNull Long requestInstanceIdArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest", getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, requestInstanceIdArg)), channelReply -> callback.reply(null)); @@ -2527,9 +2307,7 @@ public interface WebStorageHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `WebStorageHostApi` to handle messages through the `binaryMessenger`. - */ + /**Sets up an instance of `WebStorageHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorageHostApi api) { { BasicMessageChannel channel = @@ -2544,7 +2322,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorage try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2567,7 +2346,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorage try { api.deleteAllData((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2581,8 +2361,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorage } private static class FileChooserParamsFlutterApiCodec extends StandardMessageCodec { - public static final FileChooserParamsFlutterApiCodec INSTANCE = - new FileChooserParamsFlutterApiCodec(); + public static final FileChooserParamsFlutterApiCodec INSTANCE = new FileChooserParamsFlutterApiCodec(); private FileChooserParamsFlutterApiCodec() {} @@ -2610,10 +2389,9 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { /** * Handles callbacks methods for the native Java FileChooserParams class. * - *

See - * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. + * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. * - *

Generated class from Pigeon that represents Flutter messages that can be called from Java. + * Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class FileChooserParamsFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2622,7 +2400,7 @@ public FileChooserParamsFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2631,34 +2409,25 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return FileChooserParamsFlutterApiCodec.INSTANCE; } - - public void create( - @NonNull Long instanceIdArg, - @NonNull Boolean isCaptureEnabledArg, - @NonNull List acceptTypesArg, - @NonNull FileChooserModeEnumData modeArg, - @Nullable String filenameHintArg, - @NonNull Reply callback) { + public void create(@NonNull Long instanceIdArg, @NonNull Boolean isCaptureEnabledArg, @NonNull List acceptTypesArg, @NonNull FileChooserModeEnumData modeArg, @Nullable String filenameHintArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.FileChooserParamsFlutterApi.create", getCodec()); channel.send( - new ArrayList( - Arrays.asList( - instanceIdArg, isCaptureEnabledArg, acceptTypesArg, modeArg, filenameHintArg)), + new ArrayList(Arrays.asList(instanceIdArg, isCaptureEnabledArg, acceptTypesArg, modeArg, filenameHintArg)), channelReply -> callback.reply(null)); } } /** * Host API for `PermissionRequest`. * - *

This class may handle instantiating and adding native object instances that are attached to - * a Dart instance or handle method calls on the associated native class or an instance of the - * class. + * This class may handle instantiating and adding native object instances that + * are attached to a Dart instance or handle method calls on the associated + * native class or an instance of the class. * - *

See https://developer.android.com/reference/android/webkit/PermissionRequest. + * See https://developer.android.com/reference/android/webkit/PermissionRequest. * - *

Generated interface from Pigeon that represents a handler of messages from Flutter. + * Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface PermissionRequestHostApi { /** Handles Dart method `PermissionRequest.grant`. */ @@ -2670,12 +2439,8 @@ public interface PermissionRequestHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `PermissionRequestHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable PermissionRequestHostApi api) { + /**Sets up an instance of `PermissionRequestHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PermissionRequestHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2688,10 +2453,10 @@ static void setup( Number instanceIdArg = (Number) args.get(0); List resourcesArg = (List) args.get(1); try { - api.grant( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), resourcesArg); + api.grant((instanceIdArg == null) ? null : instanceIdArg.longValue(), resourcesArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2714,7 +2479,8 @@ static void setup( try { api.deny((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2729,12 +2495,13 @@ static void setup( /** * Flutter API for `PermissionRequest`. * - *

This class may handle instantiating and adding Dart instances that are attached to a native - * instance or receiving callback methods from an overridden native class. + * This class may handle instantiating and adding Dart instances that are + * attached to a native instance or receiving callback methods from an + * overridden native class. * - *

See https://developer.android.com/reference/android/webkit/PermissionRequest. + * See https://developer.android.com/reference/android/webkit/PermissionRequest. * - *

Generated class from Pigeon that represents Flutter messages that can be called from Java. + * Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class PermissionRequestFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2743,7 +2510,7 @@ public PermissionRequestFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2753,10 +2520,7 @@ public interface Reply { return new StandardMessageCodec(); } /** Create a new Dart instance and add it to the `InstanceManager`. */ - public void create( - @NonNull Long instanceIdArg, - @NonNull List resourcesArg, - @NonNull Reply callback) { + public void create(@NonNull Long instanceIdArg, @NonNull List resourcesArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.PermissionRequestFlutterApi.create", getCodec()); @@ -2765,4 +2529,88 @@ public void create( channelReply -> callback.reply(null)); } } + /** + * Host API for `CustomViewCallback`. + * + * This class may handle instantiating and adding native object instances that + * are attached to a Dart instance or handle method calls on the associated + * native class or an instance of the class. + * + * See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. + * + * Generated interface from Pigeon that represents a handler of messages from Flutter. + */ + public interface CustomViewCallbackHostApi { + /** Handles Dart method `CustomViewCallback.onCustomViewHidden`. */ + void onCustomViewHidden(@NonNull Long identifier); + + /** The codec used by CustomViewCallbackHostApi. */ + static @NonNull MessageCodec getCodec() { + return new StandardMessageCodec(); + } + /**Sets up an instance of `CustomViewCallbackHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CustomViewCallbackHostApi api) { + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + Number identifierArg = (Number) args.get(0); + try { + api.onCustomViewHidden((identifierArg == null) ? null : identifierArg.longValue()); + wrapped.add(0, null); + } + catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + } + } + /** + * Flutter API for `CustomViewCallback`. + * + * This class may handle instantiating and adding Dart instances that are + * attached to a native instance or receiving callback methods from an + * overridden native class. + * + * See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. + * + * Generated class from Pigeon that represents Flutter messages that can be called from Java. + */ + public static class CustomViewCallbackFlutterApi { + private final @NonNull BinaryMessenger binaryMessenger; + + public CustomViewCallbackFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { + this.binaryMessenger = argBinaryMessenger; + } + + /** Public interface for sending reply. */ + @SuppressWarnings("UnknownNullness") + public interface Reply { + void reply(T reply); + } + /** The codec used by CustomViewCallbackFlutterApi. */ + static @NonNull MessageCodec getCodec() { + return new StandardMessageCodec(); + } + /** Create a new Dart instance and add it to the `InstanceManager`. */ + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CustomViewCallbackFlutterApi.create", getCodec()); + channel.send( + new ArrayList(Collections.singletonList(identifierArg)), + channelReply -> callback.reply(null)); + } + } } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CustomViewCallbackTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CustomViewCallbackTest.java new file mode 100644 index 000000000000..fa11864792bb --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CustomViewCallbackTest.java @@ -0,0 +1,144 @@ + +// 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. + +// TODO(bparrishMines): Remove GenApiImpls from filename or copy classes/methods to your own implementation + +package io.flutter.plugins.webviewflutter; + +// TODO(bparrishMines): Import native classes +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import io.flutter.plugin.common.BinaryMessenger; +import java.util.Objects; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoRule; + + +import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.CustomViewCallbackFlutterApi; + + +public class CustomViewCallbackTest { + + @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); + + + + + @Mock public CustomViewCallback mockCustomViewCallback; + + + @Mock public BinaryMessenger mockBinaryMessenger; + + @Mock public CustomViewCallbackFlutterApi mockFlutterApi; + + + + InstanceManager instanceManager; + + @Before + public void setUp() { + instanceManager = InstanceManager.open(identifier -> {}); + } + + @After + public void tearDown() { + instanceManager.close(); + } + + + + + + + + + + @Test + public void onCustomViewHidden() { + + + + final long instanceIdentifier = 0; + instanceManager.addDartCreatedInstance(mockCustomViewCallback, instanceIdentifier); + + + + + + + + + + + + + + + final CustomViewCallbackHostApiImpl hostApi = + new CustomViewCallbackHostApiImpl( + mockBinaryMessenger, instanceManager ); + + + hostApi.onCustomViewHidden( + instanceIdentifier + + ); + + + + + + + + + verify( mockCustomViewCallback ) + .onCustomViewHidden( + + ); + + + + + + + } + + + + @Test + public void flutterApiCreate() { + final CustomViewCallbackFlutterApiImpl flutterApi = + new CustomViewCallbackFlutterApiImpl(mockBinaryMessenger, instanceManager); + flutterApi.setApi(mockFlutterApi); + + + + flutterApi.create( + mockCustomViewCallback, + + reply -> {}); + + final long instanceIdentifier = + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(mockCustomViewCallback)); + verify(mockFlutterApi) + .create( + eq(instanceIdentifier), + + any()); + } + + +} + diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart index 35e1767dd6b2..ca45d4b9ce7d 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart @@ -18,6 +18,8 @@ import 'instance_manager.dart'; export 'android_webview_api_impls.dart' show FileChooserMode; +import 'package:simple_ast/annotations.dart'; + /// Root of the Java class hierarchy. /// /// See https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html. @@ -82,7 +84,7 @@ class JavaObject with Copyable { /// [Web-based content](https://developer.android.com/guide/webapps). /// /// When a [WebView] is no longer needed [release] must be called. -class WebView extends JavaObject { +class WebView extends View { /// Constructs a new WebView. /// /// Due to changes in Flutter 3.0 the [useHybridComposition] doesn't have @@ -1258,3 +1260,38 @@ class WebStorage extends JavaObject { ); } } + +class View extends JavaObject { + View.detached({ + @visibleForTesting super.binaryMessenger, + @visibleForTesting super.instanceManager, + }) : super.detached(); +} + +/// A callback interface used by the host application to notify the current page +/// that its custom view has been dismissed. +/// +/// See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. +class CustomViewCallback extends JavaObject { + /// Instantiates a [CustomViewCallback] without creating and attaching to an + /// instance of the associated native class. + /// + /// This should only be used outside of tests by subclasses created by this + /// library or to create a copy for an [InstanceManager]. + @protected + CustomViewCallback.detached({ + super.binaryMessenger, + super.instanceManager, + }) : _customViewCallbackApi = CustomViewCallbackHostApiImpl( + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), + super.detached(); + + final CustomViewCallbackHostApiImpl _customViewCallbackApi; + + /// Invoked when the host application dismisses the custom view. + Future onCustomViewHidden() { + return _customViewCallbackApi.onCustomViewHiddenFromInstances(this); + } +} diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart index 7488cd863375..f8af264853a7 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart @@ -1,7 +1,7 @@ // 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. -// Autogenerated from Pigeon (v9.2.4), do not edit directly. +// Autogenerated from Pigeon (v9.2.5), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import @@ -2243,3 +2243,82 @@ abstract class PermissionRequestFlutterApi { } } } + +/// Host API for `CustomViewCallback`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +/// +/// See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. +class CustomViewCallbackHostApi { + /// Constructor for [CustomViewCallbackHostApi]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default + /// BinaryMessenger will be used which routes to the host platform. + CustomViewCallbackHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; + final BinaryMessenger? _binaryMessenger; + + static const MessageCodec codec = StandardMessageCodec(); + + /// Handles Dart method `CustomViewCallback.onCustomViewHidden`. + Future onCustomViewHidden(int arg_identifier) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden', + codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send([arg_identifier]) as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return; + } + } +} + +/// Flutter API for `CustomViewCallback`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. +abstract class CustomViewCallbackFlutterApi { + static const MessageCodec codec = StandardMessageCodec(); + + /// Create a new Dart instance and add it to the `InstanceManager`. + void create(int identifier); + + static void setup(CustomViewCallbackFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.CustomViewCallbackFlutterApi.create', codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.CustomViewCallbackFlutterApi.create was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.CustomViewCallbackFlutterApi.create was null, expected non-null int.'); + api.create(arg_identifier!); + return; + }); + } + } + } +} diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart index f1010d76f63e..18c341424cf4 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart @@ -47,6 +47,7 @@ class AndroidWebViewFlutterApis { FileChooserParamsFlutterApiImpl? fileChooserParamsFlutterApi, WebViewFlutterApiImpl? webViewFlutterApi, PermissionRequestFlutterApiImpl? permissionRequestFlutterApi, + CustomViewCallbackFlutterApiImpl? customViewCallbackFlutterApi, }) { this.javaObjectFlutterApi = javaObjectFlutterApi ?? JavaObjectFlutterApiImpl(); @@ -63,6 +64,8 @@ class AndroidWebViewFlutterApis { this.webViewFlutterApi = webViewFlutterApi ?? WebViewFlutterApiImpl(); this.permissionRequestFlutterApi = permissionRequestFlutterApi ?? PermissionRequestFlutterApiImpl(); + this.customViewCallbackFlutterApi = + customViewCallbackFlutterApi ?? CustomViewCallbackFlutterApiImpl(); } static bool _haveBeenSetUp = false; @@ -96,6 +99,9 @@ class AndroidWebViewFlutterApis { /// Flutter Api for [PermissionRequest]. late final PermissionRequestFlutterApiImpl permissionRequestFlutterApi; + /// Flutter Api for [CustomViewCallback]. + late final CustomViewCallbackFlutterApiImpl customViewCallbackFlutterApi; + /// Ensures all the Flutter APIs have been setup to receive calls from native code. void ensureSetUp() { if (!_haveBeenSetUp) { @@ -107,6 +113,7 @@ class AndroidWebViewFlutterApis { FileChooserParamsFlutterApi.setup(fileChooserParamsFlutterApi); WebViewFlutterApi.setup(webViewFlutterApi); PermissionRequestFlutterApi.setup(permissionRequestFlutterApi); + CustomViewCallbackFlutterApi.setup(customViewCallbackFlutterApi); _haveBeenSetUp = true; } } @@ -1075,3 +1082,60 @@ class PermissionRequestFlutterApiImpl implements PermissionRequestFlutterApi { ); } } + +/// Host api implementation for [CustomViewCallback]. +class CustomViewCallbackHostApiImpl extends CustomViewCallbackHostApi { + /// Constructs a [CustomViewCallbackHostApiImpl]. + CustomViewCallbackHostApiImpl({ + this.binaryMessenger, + InstanceManager? instanceManager, + }) : instanceManager = instanceManager ?? JavaObject.globalInstanceManager, + super(binaryMessenger: binaryMessenger); + + /// Sends binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; + + /// Maintains instances stored to communicate with native language objects. + final InstanceManager instanceManager; + + /// Helper method to convert instance ids to objects. + Future onCustomViewHiddenFromInstances(CustomViewCallback instance) { + return onCustomViewHidden(instanceManager.getIdentifier(instance)!); + } +} + +/// Flutter API implementation for [CustomViewCallback]. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +class CustomViewCallbackFlutterApiImpl implements CustomViewCallbackFlutterApi { + /// Constructs a [CustomViewCallbackFlutterApiImpl]. + CustomViewCallbackFlutterApiImpl({ + this.binaryMessenger, + InstanceManager? instanceManager, + }) : instanceManager = instanceManager ?? JavaObject.globalInstanceManager; + + /// Receives binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; + + /// Maintains instances stored to communicate with native language objects. + final InstanceManager instanceManager; + + @override + void create(int identifier) { + instanceManager.addHostCreatedInstance( + CustomViewCallback.detached( + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), + identifier, + ); + } +} diff --git a/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart b/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart index 62a7aa8a25b2..5d0401efed2b 100644 --- a/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart +++ b/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart @@ -399,3 +399,29 @@ abstract class PermissionRequestFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int instanceId, List resources); } + +/// Host API for `CustomViewCallback`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +/// +/// See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. +@HostApi(dartHostTestHandler: 'TestCustomViewCallbackHostApi') +abstract class CustomViewCallbackHostApi { + /// Handles Dart method `CustomViewCallback.onCustomViewHidden`. + void onCustomViewHidden(int identifier); +} + +/// Flutter API for `CustomViewCallback`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. +@FlutterApi() +abstract class CustomViewCallbackFlutterApi { + /// Create a new Dart instance and add it to the `InstanceManager`. + void create(int identifier); +} diff --git a/packages/webview_flutter/webview_flutter_android/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/pubspec.yaml index b674a5a6b645..2db8f5fc79b4 100644 --- a/packages/webview_flutter/webview_flutter_android/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_android/pubspec.yaml @@ -20,6 +20,10 @@ flutter: dependencies: flutter: sdk: flutter + simple_ast: + git: + url: git@github.com:bparrishMines/penguin.git + path: packages/simple_ast webview_flutter_platform_interface: ^2.3.0 dev_dependencies: @@ -30,3 +34,15 @@ dev_dependencies: sdk: flutter mockito: 5.4.0 pigeon: ^9.2.4 + code_template_processor: + git: + url: git@github.com:bparrishMines/penguin.git + path: packages/code_template_processor + gen_api_impls: + git: + url: git@github.com:bparrishMines/penguin.git + path: packages/gen_api_impls + simple_ast_generator: + git: + url: git@github.com:bparrishMines/penguin.git + path: packages/simple_ast_generator diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_test.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_test.dart index 73b54caabc18..70d8724db3eb 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_test.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_test.dart @@ -17,6 +17,7 @@ import 'test_android_webview.g.dart'; CookieManagerHostApi, DownloadListener, JavaScriptChannel, + TestCustomViewCallbackHostApi, TestDownloadListenerHostApi, TestInstanceManagerHostApi, TestJavaObjectHostApi, @@ -1048,6 +1049,53 @@ void main() { expect(instance.filenameHint, 'filenameHint'); }); }); + + group('CustomViewCallback', () { + tearDown(() { + TestCustomViewCallbackHostApi.setup(null); + TestInstanceManagerHostApi.setup(null); + }); + + test('onCustomViewHidden', () async { + final MockTestCustomViewCallbackHostApi mockApi = + MockTestCustomViewCallbackHostApi(); + TestCustomViewCallbackHostApi.setup(mockApi); + + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + + final CustomViewCallback instance = CustomViewCallback.detached( + instanceManager: instanceManager, + ); + const int instanceIdentifier = 0; + instanceManager.addHostCreatedInstance(instance, instanceIdentifier); + + await instance.onCustomViewHidden(); + + verify(mockApi.onCustomViewHidden(instanceIdentifier)); + }); + + test('FlutterAPI create', () { + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + + final CustomViewCallbackFlutterApiImpl api = + CustomViewCallbackFlutterApiImpl( + instanceManager: instanceManager, + ); + + const int instanceIdentifier = 0; + + api.create(instanceIdentifier); + + expect( + instanceManager.getInstanceWithWeakReference(instanceIdentifier), + isA(), + ); + }); + }); }); group('CookieManager', () { diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_test.mocks.dart index 58448c063de7..6e83b1f86a2c 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_test.mocks.dart @@ -223,6 +223,25 @@ class MockJavaScriptChannel extends _i1.Mock implements _i2.JavaScriptChannel { ) as _i2.JavaScriptChannel); } +/// A class which mocks [TestCustomViewCallbackHostApi]. +/// +/// See the documentation for Mockito's code generation for more information. +class MockTestCustomViewCallbackHostApi extends _i1.Mock + implements _i6.TestCustomViewCallbackHostApi { + MockTestCustomViewCallbackHostApi() { + _i1.throwOnMissingStub(this); + } + + @override + void onCustomViewHidden(int? identifier) => super.noSuchMethod( + Invocation.method( + #onCustomViewHidden, + [identifier], + ), + returnValueForMissingStub: null, + ); +} + /// A class which mocks [TestDownloadListenerHostApi]. /// /// See the documentation for Mockito's code generation for more information. diff --git a/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart index fca0b96dd87a..28de58a4575b 100644 --- a/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart +++ b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart @@ -1,7 +1,7 @@ // 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. -// Autogenerated from Pigeon (v9.2.4), do not edit directly. +// Autogenerated from Pigeon (v9.2.5), do not edit directly. // See also: https://pub.dev/packages/pigeon // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, unnecessary_import // ignore_for_file: avoid_relative_lib_imports @@ -15,8 +15,7 @@ import 'package:webview_flutter_android/src/android_webview.g.dart'; /// Host API for managing the native `InstanceManager`. abstract class TestInstanceManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Clear the native `InstanceManager`. @@ -24,19 +23,15 @@ abstract class TestInstanceManagerHostApi { /// This is typically only used after a hot restart. void clear(); - static void setup(TestInstanceManagerHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestInstanceManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.InstanceManagerHostApi.clear', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { // ignore message api.clear(); return []; @@ -52,27 +47,22 @@ abstract class TestInstanceManagerHostApi { /// /// See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. abstract class TestJavaObjectHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void dispose(int identifier); - static void setup(TestJavaObjectHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestJavaObjectHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaObjectHostApi.dispose', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -100,7 +90,7 @@ class _TestWebViewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebViewPoint.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -109,17 +99,14 @@ class _TestWebViewHostApiCodec extends StandardMessageCodec { } abstract class TestWebViewHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestWebViewHostApiCodec(); void create(int instanceId); - void loadData( - int instanceId, String data, String? mimeType, String? encoding); + void loadData(int instanceId, String data, String? mimeType, String? encoding); - void loadDataWithBaseUrl(int instanceId, String? baseUrl, String data, - String? mimeType, String? encoding, String? historyUrl); + void loadDataWithBaseUrl(int instanceId, String? baseUrl, String data, String? mimeType, String? encoding, String? historyUrl); void loadUrl(int instanceId, String url, Map headers); @@ -167,21 +154,17 @@ abstract class TestWebViewHostApi { void setBackgroundColor(int instanceId, int color); - static void setup(TestWebViewHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebViewHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -196,14 +179,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.loadData', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -223,14 +203,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -242,8 +219,7 @@ abstract class TestWebViewHostApi { final String? arg_mimeType = (args[3] as String?); final String? arg_encoding = (args[4] as String?); final String? arg_historyUrl = (args[5] as String?); - api.loadDataWithBaseUrl(arg_instanceId!, arg_baseUrl, arg_data!, - arg_mimeType, arg_encoding, arg_historyUrl); + api.loadDataWithBaseUrl(arg_instanceId!, arg_baseUrl, arg_data!, arg_mimeType, arg_encoding, arg_historyUrl); return []; }); } @@ -253,14 +229,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.loadUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -268,8 +241,7 @@ abstract class TestWebViewHostApi { final String? arg_url = (args[1] as String?); assert(arg_url != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null String.'); - final Map? arg_headers = - (args[2] as Map?)?.cast(); + final Map? arg_headers = (args[2] as Map?)?.cast(); assert(arg_headers != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null Map.'); api.loadUrl(arg_instanceId!, arg_url!, arg_headers!); @@ -282,14 +254,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.postUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -310,14 +279,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -332,14 +298,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.canGoBack', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoBack was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -354,14 +317,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.canGoForward', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoForward was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -376,14 +336,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.goBack', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.goBack was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.goBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -398,14 +355,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.goForward', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.goForward was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.goForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -420,14 +374,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.reload', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.reload was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.reload was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -442,14 +393,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.clearCache', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -467,14 +415,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.evaluateJavascript', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -482,8 +427,7 @@ abstract class TestWebViewHostApi { final String? arg_javascriptString = (args[1] as String?); assert(arg_javascriptString != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null, expected non-null String.'); - final String? output = await api.evaluateJavascript( - arg_instanceId!, arg_javascriptString!); + final String? output = await api.evaluateJavascript(arg_instanceId!, arg_javascriptString!); return [output]; }); } @@ -493,14 +437,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getTitle', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getTitle was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getTitle was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -515,14 +456,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.scrollTo', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -543,14 +481,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.scrollBy', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -571,14 +506,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getScrollX', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollX was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollX was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -593,14 +525,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getScrollY', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollY was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollY was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -615,14 +544,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getScrollPosition', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollPosition was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollPosition was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -634,18 +560,14 @@ abstract class TestWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', - codec, + 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled was null.'); final List args = (message as List?)!; final bool? arg_enabled = (args[0] as bool?); assert(arg_enabled != null, @@ -660,14 +582,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setWebViewClient', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -685,14 +604,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -700,8 +616,7 @@ abstract class TestWebViewHostApi { final int? arg_javaScriptChannelInstanceId = (args[1] as int?); assert(arg_javaScriptChannelInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null, expected non-null int.'); - api.addJavaScriptChannel( - arg_instanceId!, arg_javaScriptChannelInstanceId!); + api.addJavaScriptChannel(arg_instanceId!, arg_javaScriptChannelInstanceId!); return []; }); } @@ -711,14 +626,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -726,8 +638,7 @@ abstract class TestWebViewHostApi { final int? arg_javaScriptChannelInstanceId = (args[1] as int?); assert(arg_javaScriptChannelInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null, expected non-null int.'); - api.removeJavaScriptChannel( - arg_instanceId!, arg_javaScriptChannelInstanceId!); + api.removeJavaScriptChannel(arg_instanceId!, arg_javaScriptChannelInstanceId!); return []; }); } @@ -737,14 +648,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setDownloadListener', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -760,14 +668,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setWebChromeClient', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -783,14 +688,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setBackgroundColor', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -807,8 +709,7 @@ abstract class TestWebViewHostApi { } abstract class TestWebSettingsHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId, int webViewInstanceId); @@ -839,21 +740,17 @@ abstract class TestWebSettingsHostApi { void setTextZoom(int instanceId, int textZoom); - static void setup(TestWebSettingsHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebSettingsHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -871,14 +768,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -893,18 +787,14 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -912,26 +802,21 @@ abstract class TestWebSettingsHostApi { final bool? arg_flag = (args[1] as bool?); assert(arg_flag != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null, expected non-null bool.'); - api.setJavaScriptCanOpenWindowsAutomatically( - arg_instanceId!, arg_flag!); + api.setJavaScriptCanOpenWindowsAutomatically(arg_instanceId!, arg_flag!); return []; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -949,14 +834,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -974,14 +856,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -994,18 +873,14 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1013,8 +888,7 @@ abstract class TestWebSettingsHostApi { final bool? arg_require = (args[1] as bool?); assert(arg_require != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null, expected non-null bool.'); - api.setMediaPlaybackRequiresUserGesture( - arg_instanceId!, arg_require!); + api.setMediaPlaybackRequiresUserGesture(arg_instanceId!, arg_require!); return []; }); } @@ -1024,14 +898,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1046,18 +917,14 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1075,14 +942,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1100,14 +964,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1125,14 +986,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1150,14 +1008,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1175,14 +1030,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setTextZoom', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setTextZoom was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setTextZoom was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1199,27 +1051,22 @@ abstract class TestWebSettingsHostApi { } abstract class TestJavaScriptChannelHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId, String channelName); - static void setup(TestJavaScriptChannelHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestJavaScriptChannelHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1236,30 +1083,24 @@ abstract class TestJavaScriptChannelHostApi { } abstract class TestWebViewClientHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - void setSynchronousReturnValueForShouldOverrideUrlLoading( - int instanceId, bool value); + void setSynchronousReturnValueForShouldOverrideUrlLoading(int instanceId, bool value); - static void setup(TestWebViewClientHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebViewClientHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewClientHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1271,18 +1112,14 @@ abstract class TestWebViewClientHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', - codec, + 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1290,8 +1127,7 @@ abstract class TestWebViewClientHostApi { final bool? arg_value = (args[1] as bool?); assert(arg_value != null, 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null, expected non-null bool.'); - api.setSynchronousReturnValueForShouldOverrideUrlLoading( - arg_instanceId!, arg_value!); + api.setSynchronousReturnValueForShouldOverrideUrlLoading(arg_instanceId!, arg_value!); return []; }); } @@ -1300,27 +1136,22 @@ abstract class TestWebViewClientHostApi { } abstract class TestDownloadListenerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - static void setup(TestDownloadListenerHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestDownloadListenerHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.DownloadListenerHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.DownloadListenerHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.DownloadListenerHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1334,30 +1165,24 @@ abstract class TestDownloadListenerHostApi { } abstract class TestWebChromeClientHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - void setSynchronousReturnValueForOnShowFileChooser( - int instanceId, bool value); + void setSynchronousReturnValueForOnShowFileChooser(int instanceId, bool value); - static void setup(TestWebChromeClientHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebChromeClientHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebChromeClientHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1369,18 +1194,14 @@ abstract class TestWebChromeClientHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', - codec, + 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1388,8 +1209,7 @@ abstract class TestWebChromeClientHostApi { final bool? arg_value = (args[1] as bool?); assert(arg_value != null, 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null, expected non-null bool.'); - api.setSynchronousReturnValueForOnShowFileChooser( - arg_instanceId!, arg_value!); + api.setSynchronousReturnValueForOnShowFileChooser(arg_instanceId!, arg_value!); return []; }); } @@ -1398,29 +1218,24 @@ abstract class TestWebChromeClientHostApi { } abstract class TestAssetManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); List list(String path); String getAssetFilePathByName(String name); - static void setup(TestAssetManagerHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestAssetManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FlutterAssetManagerHostApi.list', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.list was null.'); + 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.list was null.'); final List args = (message as List?)!; final String? arg_path = (args[0] as String?); assert(arg_path != null, @@ -1432,18 +1247,14 @@ abstract class TestAssetManagerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', - codec, + 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName was null.'); + 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName was null.'); final List args = (message as List?)!; final String? arg_name = (args[0] as String?); assert(arg_name != null, @@ -1457,29 +1268,24 @@ abstract class TestAssetManagerHostApi { } abstract class TestWebStorageHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); void deleteAllData(int instanceId); - static void setup(TestWebStorageHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebStorageHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebStorageHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebStorageHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebStorageHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1494,14 +1300,11 @@ abstract class TestWebStorageHostApi { 'dev.flutter.pigeon.WebStorageHostApi.deleteAllData', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebStorageHostApi.deleteAllData was null.'); + 'Argument for dev.flutter.pigeon.WebStorageHostApi.deleteAllData was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1522,8 +1325,7 @@ abstract class TestWebStorageHostApi { /// /// See https://developer.android.com/reference/android/webkit/PermissionRequest. abstract class TestPermissionRequestHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Handles Dart method `PermissionRequest.grant`. @@ -1532,27 +1334,22 @@ abstract class TestPermissionRequestHostApi { /// Handles Dart method `PermissionRequest.deny`. void deny(int instanceId); - static void setup(TestPermissionRequestHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestPermissionRequestHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PermissionRequestHostApi.grant', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null.'); + 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null, expected non-null int.'); - final List? arg_resources = - (args[1] as List?)?.cast(); + final List? arg_resources = (args[1] as List?)?.cast(); assert(arg_resources != null, 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null, expected non-null List.'); api.grant(arg_instanceId!, arg_resources!); @@ -1565,14 +1362,11 @@ abstract class TestPermissionRequestHostApi { 'dev.flutter.pigeon.PermissionRequestHostApi.deny', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.deny was null.'); + 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.deny was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1584,3 +1378,40 @@ abstract class TestPermissionRequestHostApi { } } } + +/// Host API for `CustomViewCallback`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +/// +/// See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. +abstract class TestCustomViewCallbackHostApi { + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static const MessageCodec codec = StandardMessageCodec(); + + /// Handles Dart method `CustomViewCallback.onCustomViewHidden`. + void onCustomViewHidden(int identifier); + + static void setup(TestCustomViewCallbackHostApi? api, {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden', codec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden was null, expected non-null int.'); + api.onCustomViewHidden(arg_identifier!); + return []; + }); + } + } + } +} From 0cd62d058b74f512fd2f0ef052e28ced8c341f6f Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 30 May 2023 11:34:57 -0400 Subject: [PATCH 08/35] view dart impl --- .../GeneratedAndroidWebView.java | 37 ++ .../webviewflutter/ViewFlutterApiImpl.java | 77 ++++ .../plugins/webviewflutter/ViewTest.java | 92 ++++ .../lib/src/android_webview.dart | 15 +- .../lib/src/android_webview.g.dart | 418 ++++++++---------- .../lib/src/android_webview_api_impls.dart | 39 ++ .../pigeons/android_webview.dart | 13 + .../test/android_webview_test.dart | 22 +- 8 files changed, 474 insertions(+), 239 deletions(-) create mode 100644 packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewFlutterApiImpl.java create mode 100644 packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java index 01e6fa9122a8..4296c8877d0b 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java @@ -2613,4 +2613,41 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { channelReply -> callback.reply(null)); } } + /** + * Flutter API for `View`. + * + * This class may handle instantiating and adding Dart instances that are + * attached to a native instance or receiving callback methods from an + * overridden native class. + * + * See https://developer.android.com/reference/android/view/View. + * + * Generated class from Pigeon that represents Flutter messages that can be called from Java. + */ + public static class ViewFlutterApi { + private final @NonNull BinaryMessenger binaryMessenger; + + public ViewFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { + this.binaryMessenger = argBinaryMessenger; + } + + /** Public interface for sending reply. */ + @SuppressWarnings("UnknownNullness") + public interface Reply { + void reply(T reply); + } + /** The codec used by ViewFlutterApi. */ + static @NonNull MessageCodec getCodec() { + return new StandardMessageCodec(); + } + /** Create a new Dart instance and add it to the `InstanceManager`. */ + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.ViewFlutterApi.create", getCodec()); + channel.send( + new ArrayList(Collections.singletonList(identifierArg)), + channelReply -> callback.reply(null)); + } + } } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewFlutterApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewFlutterApiImpl.java new file mode 100644 index 000000000000..44a53acf786d --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewFlutterApiImpl.java @@ -0,0 +1,77 @@ + +// 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. + +// TODO(bparrishMines): Remove GenApiImpls from filename or copy classes/methods to your own implementation + +package io.flutter.plugins.webviewflutter; + + +// TODO(bparrishMines): Import native classes +import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.ViewFlutterApi; +import androidx.annotation.NonNull; +import androidx.annotation.Nullable; +import androidx.annotation.VisibleForTesting; +import io.flutter.plugin.common.BinaryMessenger; +import java.util.Objects; + +/** + * Flutter API implementation for `View`. + * + *

This class may handle adding native instances that are attached to a Dart instance or passing + * arguments of callbacks methods to a Dart instance. + */ + +public class ViewFlutterApiImpl { + + // To ease adding additional methods, this value is added prematurely. + @SuppressWarnings({"unused", "FieldCanBeLocal"}) + private final BinaryMessenger binaryMessenger; + + private final InstanceManager instanceManager; + private ViewFlutterApi api; + + /** + * Constructs a {@link ViewFlutterApiImpl}. + * + * @param binaryMessenger used to communicate with Dart over asynchronous messages + * @param instanceManager maintains instances stored to communicate with attached Dart objects + */ + public ViewFlutterApiImpl( + @NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { + this.binaryMessenger = binaryMessenger; + this.instanceManager = instanceManager; + api = new ViewFlutterApi(binaryMessenger); + } + + /** + * Stores the `View` instance and notifies Dart to create and store a new + * `View` instance that is attached to this one. If `instance` has already been added, + * this method does nothing. + */ + public void create( + @NonNull View instance, + + @NonNull ViewFlutterApi.Reply callback) { + if (!instanceManager.containsInstance(instance)) { + api.create( + instanceManager.addHostCreatedInstance(instance), + + callback); + } + } + + + + /** + * Sets the Flutter API used to send messages to Dart. + * + *

This is only visible for testing. + */ + @VisibleForTesting + void setApi(@NonNull ViewFlutterApi api) { + this.api = api; + } +} + diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java new file mode 100644 index 000000000000..e13b826cb2fc --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java @@ -0,0 +1,92 @@ + +// 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. + +// TODO(bparrishMines): Remove GenApiImpls from filename or copy classes/methods to your own implementation + +package io.flutter.plugins.webviewflutter; + +// TODO(bparrishMines): Import native classes +import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import io.flutter.plugin.common.BinaryMessenger; +import java.util.Objects; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnit; +import org.mockito.junit.MockitoRule; + + +import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.ViewFlutterApi; + + +public class ViewTest { + + @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); + + + + + @Mock public View mockView; + + + @Mock public BinaryMessenger mockBinaryMessenger; + + @Mock public ViewFlutterApi mockFlutterApi; + + + + InstanceManager instanceManager; + + @Before + public void setUp() { + instanceManager = InstanceManager.open(identifier -> {}); + } + + @After + public void tearDown() { + instanceManager.close(); + } + + + + + + + + + + @Test + public void flutterApiCreate() { + final ViewFlutterApiImpl flutterApi = + new ViewFlutterApiImpl(mockBinaryMessenger, instanceManager); + flutterApi.setApi(mockFlutterApi); + + + + flutterApi.create( + mockView, + + reply -> {}); + + final long instanceIdentifier = + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(mockView)); + verify(mockFlutterApi) + .create( + eq(instanceIdentifier), + + any()); + } + + +} + diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart index ca45d4b9ce7d..12fa7faf639c 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart @@ -1261,11 +1261,18 @@ class WebStorage extends JavaObject { } } +/// The basic building block for user interface components. +/// +/// See https://developer.android.com/reference/android/view/View. class View extends JavaObject { - View.detached({ - @visibleForTesting super.binaryMessenger, - @visibleForTesting super.instanceManager, - }) : super.detached(); + /// Instantiates a [View] without creating and attaching to an + /// instance of the associated native class. + /// + /// This should only be used outside of tests by subclasses created by this + /// library or to create a copy for an [InstanceManager]. + @protected + View.detached({super.binaryMessenger, super.instanceManager}) + : super.detached(); } /// A callback interface used by the host application to notify the current page diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart index f8af264853a7..a8e6ae227e57 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart @@ -20,12 +20,10 @@ enum FileChooserMode { /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN. open, - /// Similar to [open] but allows multiple files to be selected. /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE. openMultiple, - /// Allows picking a nonexistent file and saving it. /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE. @@ -94,8 +92,7 @@ class WebResourceRequestData { isRedirect: result[2] as bool?, hasGesture: result[3]! as bool, method: result[4]! as String, - requestHeaders: - (result[5] as Map?)!.cast(), + requestHeaders: (result[5] as Map?)!.cast(), ); } } @@ -170,7 +167,8 @@ class InstanceManagerHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.InstanceManagerHostApi.clear', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; + final List? replyList = + await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -234,8 +232,7 @@ abstract class JavaObjectFlutterApi { void dispose(int identifier); - static void setup(JavaObjectFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(JavaObjectFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaObjectFlutterApi.dispose', codec, @@ -245,7 +242,7 @@ abstract class JavaObjectFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -272,7 +269,8 @@ class CookieManagerHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CookieManagerHostApi.clearCookies', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; + final List? replyList = + await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -332,7 +330,7 @@ class _WebViewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebViewPoint.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -372,14 +370,12 @@ class WebViewHostApi { } } - Future loadData(int arg_instanceId, String arg_data, - String? arg_mimeType, String? arg_encoding) async { + Future loadData(int arg_instanceId, String arg_data, String? arg_mimeType, String? arg_encoding) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.loadData', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send( - [arg_instanceId, arg_data, arg_mimeType, arg_encoding]) - as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_data, arg_mimeType, arg_encoding]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -396,24 +392,12 @@ class WebViewHostApi { } } - Future loadDataWithBaseUrl( - int arg_instanceId, - String? arg_baseUrl, - String arg_data, - String? arg_mimeType, - String? arg_encoding, - String? arg_historyUrl) async { + Future loadDataWithBaseUrl(int arg_instanceId, String? arg_baseUrl, String arg_data, String? arg_mimeType, String? arg_encoding, String? arg_historyUrl) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send([ - arg_instanceId, - arg_baseUrl, - arg_data, - arg_mimeType, - arg_encoding, - arg_historyUrl - ]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_baseUrl, arg_data, arg_mimeType, arg_encoding, arg_historyUrl]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -430,14 +414,12 @@ class WebViewHostApi { } } - Future loadUrl(int arg_instanceId, String arg_url, - Map arg_headers) async { + Future loadUrl(int arg_instanceId, String arg_url, Map arg_headers) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.loadUrl', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_url, arg_headers]) - as List?; + await channel.send([arg_instanceId, arg_url, arg_headers]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -454,13 +436,12 @@ class WebViewHostApi { } } - Future postUrl( - int arg_instanceId, String arg_url, Uint8List arg_data) async { + Future postUrl(int arg_instanceId, String arg_url, Uint8List arg_data) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.postUrl', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_url, arg_data]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_url, arg_data]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -624,8 +605,7 @@ class WebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.clearCache', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_includeDiskFiles]) - as List?; + await channel.send([arg_instanceId, arg_includeDiskFiles]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -642,14 +622,12 @@ class WebViewHostApi { } } - Future evaluateJavascript( - int arg_instanceId, String arg_javascriptString) async { + Future evaluateJavascript(int arg_instanceId, String arg_javascriptString) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.evaluateJavascript', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_javascriptString]) - as List?; + await channel.send([arg_instanceId, arg_javascriptString]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -692,8 +670,8 @@ class WebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.scrollTo', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_x, arg_y]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_x, arg_y]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -714,8 +692,8 @@ class WebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.scrollBy', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_x, arg_y]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_x, arg_y]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -815,8 +793,7 @@ class WebViewHostApi { Future setWebContentsDebuggingEnabled(bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', - codec, + 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_enabled]) as List?; @@ -836,14 +813,12 @@ class WebViewHostApi { } } - Future setWebViewClient( - int arg_instanceId, int arg_webViewClientInstanceId) async { + Future setWebViewClient(int arg_instanceId, int arg_webViewClientInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setWebViewClient', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_webViewClientInstanceId]) - as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_webViewClientInstanceId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -860,14 +835,12 @@ class WebViewHostApi { } } - Future addJavaScriptChannel( - int arg_instanceId, int arg_javaScriptChannelInstanceId) async { + Future addJavaScriptChannel(int arg_instanceId, int arg_javaScriptChannelInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_javaScriptChannelInstanceId]) - as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_javaScriptChannelInstanceId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -884,14 +857,12 @@ class WebViewHostApi { } } - Future removeJavaScriptChannel( - int arg_instanceId, int arg_javaScriptChannelInstanceId) async { + Future removeJavaScriptChannel(int arg_instanceId, int arg_javaScriptChannelInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_javaScriptChannelInstanceId]) - as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_javaScriptChannelInstanceId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -908,14 +879,12 @@ class WebViewHostApi { } } - Future setDownloadListener( - int arg_instanceId, int? arg_listenerInstanceId) async { + Future setDownloadListener(int arg_instanceId, int? arg_listenerInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setDownloadListener', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_listenerInstanceId]) - as List?; + await channel.send([arg_instanceId, arg_listenerInstanceId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -932,14 +901,12 @@ class WebViewHostApi { } } - Future setWebChromeClient( - int arg_instanceId, int? arg_clientInstanceId) async { + Future setWebChromeClient(int arg_instanceId, int? arg_clientInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setWebChromeClient', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_clientInstanceId]) - as List?; + await channel.send([arg_instanceId, arg_clientInstanceId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -960,8 +927,8 @@ class WebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setBackgroundColor', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_color]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_color]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -992,8 +959,7 @@ abstract class WebViewFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int identifier); - static void setup(WebViewFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(WebViewFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewFlutterApi.create', codec, @@ -1003,7 +969,7 @@ abstract class WebViewFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebViewFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1031,8 +997,7 @@ class WebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.create', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_webViewInstanceId]) - as List?; + await channel.send([arg_instanceId, arg_webViewInstanceId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1053,8 +1018,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_flag]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_flag]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1071,14 +1036,12 @@ class WebSettingsHostApi { } } - Future setJavaScriptCanOpenWindowsAutomatically( - int arg_instanceId, bool arg_flag) async { + Future setJavaScriptCanOpenWindowsAutomatically(int arg_instanceId, bool arg_flag) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_flag]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_flag]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1095,14 +1058,12 @@ class WebSettingsHostApi { } } - Future setSupportMultipleWindows( - int arg_instanceId, bool arg_support) async { + Future setSupportMultipleWindows(int arg_instanceId, bool arg_support) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_support]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_support]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1123,8 +1084,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_flag]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_flag]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1141,13 +1102,12 @@ class WebSettingsHostApi { } } - Future setUserAgentString( - int arg_instanceId, String? arg_userAgentString) async { + Future setUserAgentString(int arg_instanceId, String? arg_userAgentString) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_userAgentString]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_userAgentString]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1164,14 +1124,12 @@ class WebSettingsHostApi { } } - Future setMediaPlaybackRequiresUserGesture( - int arg_instanceId, bool arg_require) async { + Future setMediaPlaybackRequiresUserGesture(int arg_instanceId, bool arg_require) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_require]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_require]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1192,8 +1150,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_support]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_support]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1210,13 +1168,12 @@ class WebSettingsHostApi { } } - Future setLoadWithOverviewMode( - int arg_instanceId, bool arg_overview) async { + Future setLoadWithOverviewMode(int arg_instanceId, bool arg_overview) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_overview]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_overview]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1237,8 +1194,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_use]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_use]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1255,13 +1212,12 @@ class WebSettingsHostApi { } } - Future setDisplayZoomControls( - int arg_instanceId, bool arg_enabled) async { + Future setDisplayZoomControls(int arg_instanceId, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_enabled]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1278,13 +1234,12 @@ class WebSettingsHostApi { } } - Future setBuiltInZoomControls( - int arg_instanceId, bool arg_enabled) async { + Future setBuiltInZoomControls(int arg_instanceId, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_enabled]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1305,8 +1260,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_enabled]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1327,8 +1282,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setTextZoom', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_textZoom]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_textZoom]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1360,8 +1315,8 @@ class JavaScriptChannelHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_channelName]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_channelName]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1384,8 +1339,7 @@ abstract class JavaScriptChannelFlutterApi { void postMessage(int instanceId, String message); - static void setup(JavaScriptChannelFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(JavaScriptChannelFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage', codec, @@ -1395,7 +1349,7 @@ abstract class JavaScriptChannelFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage was null.'); + 'Argument for dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1443,14 +1397,12 @@ class WebViewClientHostApi { } } - Future setSynchronousReturnValueForShouldOverrideUrlLoading( - int arg_instanceId, bool arg_value) async { + Future setSynchronousReturnValueForShouldOverrideUrlLoading(int arg_instanceId, bool arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', - codec, + 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_value]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_value]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1486,9 +1438,9 @@ class _WebViewClientFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebResourceErrorData.decode(readValue(buffer)!); - case 129: + case 129: return WebResourceRequestData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1503,22 +1455,17 @@ abstract class WebViewClientFlutterApi { void onPageFinished(int instanceId, int webViewInstanceId, String url); - void onReceivedRequestError(int instanceId, int webViewInstanceId, - WebResourceRequestData request, WebResourceErrorData error); + void onReceivedRequestError(int instanceId, int webViewInstanceId, WebResourceRequestData request, WebResourceErrorData error); - void onReceivedError(int instanceId, int webViewInstanceId, int errorCode, - String description, String failingUrl); + void onReceivedError(int instanceId, int webViewInstanceId, int errorCode, String description, String failingUrl); - void requestLoading( - int instanceId, int webViewInstanceId, WebResourceRequestData request); + void requestLoading(int instanceId, int webViewInstanceId, WebResourceRequestData request); void urlLoading(int instanceId, int webViewInstanceId, String url); - void doUpdateVisitedHistory( - int instanceId, int webViewInstanceId, String url, bool isReload); + void doUpdateVisitedHistory(int instanceId, int webViewInstanceId, String url, bool isReload); - static void setup(WebViewClientFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(WebViewClientFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted', codec, @@ -1528,7 +1475,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1553,7 +1500,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1571,15 +1518,14 @@ abstract class WebViewClientFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError', - codec, + 'dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1587,16 +1533,13 @@ abstract class WebViewClientFlutterApi { final int? arg_webViewInstanceId = (args[1] as int?); assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null int.'); - final WebResourceRequestData? arg_request = - (args[2] as WebResourceRequestData?); + final WebResourceRequestData? arg_request = (args[2] as WebResourceRequestData?); assert(arg_request != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null WebResourceRequestData.'); - final WebResourceErrorData? arg_error = - (args[3] as WebResourceErrorData?); + final WebResourceErrorData? arg_error = (args[3] as WebResourceErrorData?); assert(arg_error != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null WebResourceErrorData.'); - api.onReceivedRequestError(arg_instanceId!, arg_webViewInstanceId!, - arg_request!, arg_error!); + api.onReceivedRequestError(arg_instanceId!, arg_webViewInstanceId!, arg_request!, arg_error!); return; }); } @@ -1610,7 +1553,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1627,8 +1570,7 @@ abstract class WebViewClientFlutterApi { final String? arg_failingUrl = (args[4] as String?); assert(arg_failingUrl != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null String.'); - api.onReceivedError(arg_instanceId!, arg_webViewInstanceId!, - arg_errorCode!, arg_description!, arg_failingUrl!); + api.onReceivedError(arg_instanceId!, arg_webViewInstanceId!, arg_errorCode!, arg_description!, arg_failingUrl!); return; }); } @@ -1642,7 +1584,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1650,12 +1592,10 @@ abstract class WebViewClientFlutterApi { final int? arg_webViewInstanceId = (args[1] as int?); assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null, expected non-null int.'); - final WebResourceRequestData? arg_request = - (args[2] as WebResourceRequestData?); + final WebResourceRequestData? arg_request = (args[2] as WebResourceRequestData?); assert(arg_request != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null, expected non-null WebResourceRequestData.'); - api.requestLoading( - arg_instanceId!, arg_webViewInstanceId!, arg_request!); + api.requestLoading(arg_instanceId!, arg_webViewInstanceId!, arg_request!); return; }); } @@ -1669,7 +1609,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1687,15 +1627,14 @@ abstract class WebViewClientFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory', - codec, + 'dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1709,8 +1648,7 @@ abstract class WebViewClientFlutterApi { final bool? arg_isReload = (args[3] as bool?); assert(arg_isReload != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null, expected non-null bool.'); - api.doUpdateVisitedHistory( - arg_instanceId!, arg_webViewInstanceId!, arg_url!, arg_isReload!); + api.doUpdateVisitedHistory(arg_instanceId!, arg_webViewInstanceId!, arg_url!, arg_isReload!); return; }); } @@ -1754,22 +1692,19 @@ class DownloadListenerHostApi { abstract class DownloadListenerFlutterApi { static const MessageCodec codec = StandardMessageCodec(); - void onDownloadStart(int instanceId, String url, String userAgent, - String contentDisposition, String mimetype, int contentLength); + void onDownloadStart(int instanceId, String url, String userAgent, String contentDisposition, String mimetype, int contentLength); - static void setup(DownloadListenerFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(DownloadListenerFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart', - codec, + 'dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null.'); + 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1789,8 +1724,7 @@ abstract class DownloadListenerFlutterApi { final int? arg_contentLength = (args[5] as int?); assert(arg_contentLength != null, 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null int.'); - api.onDownloadStart(arg_instanceId!, arg_url!, arg_userAgent!, - arg_contentDisposition!, arg_mimetype!, arg_contentLength!); + api.onDownloadStart(arg_instanceId!, arg_url!, arg_userAgent!, arg_contentDisposition!, arg_mimetype!, arg_contentLength!); return; }); } @@ -1830,14 +1764,12 @@ class WebChromeClientHostApi { } } - Future setSynchronousReturnValueForOnShowFileChooser( - int arg_instanceId, bool arg_value) async { + Future setSynchronousReturnValueForOnShowFileChooser(int arg_instanceId, bool arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', - codec, + 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_value]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_value]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1894,8 +1826,7 @@ class FlutterAssetManagerHostApi { Future getAssetFilePathByName(String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', - codec, + 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_name]) as List?; @@ -1926,25 +1857,22 @@ abstract class WebChromeClientFlutterApi { void onProgressChanged(int instanceId, int webViewInstanceId, int progress); - Future> onShowFileChooser( - int instanceId, int webViewInstanceId, int paramsInstanceId); + Future> onShowFileChooser(int instanceId, int webViewInstanceId, int paramsInstanceId); /// Callback to Dart function `WebChromeClient.onPermissionRequest`. void onPermissionRequest(int instanceId, int requestInstanceId); - static void setup(WebChromeClientFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(WebChromeClientFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged', - codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1955,23 +1883,21 @@ abstract class WebChromeClientFlutterApi { final int? arg_progress = (args[2] as int?); assert(arg_progress != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null, expected non-null int.'); - api.onProgressChanged( - arg_instanceId!, arg_webViewInstanceId!, arg_progress!); + api.onProgressChanged(arg_instanceId!, arg_webViewInstanceId!, arg_progress!); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser', - codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1982,23 +1908,21 @@ abstract class WebChromeClientFlutterApi { final int? arg_paramsInstanceId = (args[2] as int?); assert(arg_paramsInstanceId != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null, expected non-null int.'); - final List output = await api.onShowFileChooser( - arg_instanceId!, arg_webViewInstanceId!, arg_paramsInstanceId!); + final List output = await api.onShowFileChooser(arg_instanceId!, arg_webViewInstanceId!, arg_paramsInstanceId!); return output; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest', - codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -2084,7 +2008,7 @@ class _FileChooserParamsFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return FileChooserModeEnumData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -2096,14 +2020,11 @@ class _FileChooserParamsFlutterApiCodec extends StandardMessageCodec { /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. abstract class FileChooserParamsFlutterApi { - static const MessageCodec codec = - _FileChooserParamsFlutterApiCodec(); + static const MessageCodec codec = _FileChooserParamsFlutterApiCodec(); - void create(int instanceId, bool isCaptureEnabled, List acceptTypes, - FileChooserModeEnumData mode, String? filenameHint); + void create(int instanceId, bool isCaptureEnabled, List acceptTypes, FileChooserModeEnumData mode, String? filenameHint); - static void setup(FileChooserParamsFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(FileChooserParamsFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FileChooserParamsFlutterApi.create', codec, @@ -2113,7 +2034,7 @@ abstract class FileChooserParamsFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -2121,17 +2042,14 @@ abstract class FileChooserParamsFlutterApi { final bool? arg_isCaptureEnabled = (args[1] as bool?); assert(arg_isCaptureEnabled != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null bool.'); - final List? arg_acceptTypes = - (args[2] as List?)?.cast(); + final List? arg_acceptTypes = (args[2] as List?)?.cast(); assert(arg_acceptTypes != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null List.'); - final FileChooserModeEnumData? arg_mode = - (args[3] as FileChooserModeEnumData?); + final FileChooserModeEnumData? arg_mode = (args[3] as FileChooserModeEnumData?); assert(arg_mode != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null FileChooserModeEnumData.'); final String? arg_filenameHint = (args[4] as String?); - api.create(arg_instanceId!, arg_isCaptureEnabled!, arg_acceptTypes!, - arg_mode!, arg_filenameHint); + api.create(arg_instanceId!, arg_isCaptureEnabled!, arg_acceptTypes!, arg_mode!, arg_filenameHint); return; }); } @@ -2161,8 +2079,8 @@ class PermissionRequestHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PermissionRequestHostApi.grant', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_resources]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_resources]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2216,8 +2134,7 @@ abstract class PermissionRequestFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int instanceId, List resources); - static void setup(PermissionRequestFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(PermissionRequestFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PermissionRequestFlutterApi.create', codec, @@ -2227,13 +2144,12 @@ abstract class PermissionRequestFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PermissionRequestFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.PermissionRequestFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.PermissionRequestFlutterApi.create was null, expected non-null int.'); - final List? arg_resources = - (args[1] as List?)?.cast(); + final List? arg_resources = (args[1] as List?)?.cast(); assert(arg_resources != null, 'Argument for dev.flutter.pigeon.PermissionRequestFlutterApi.create was null, expected non-null List.'); api.create(arg_instanceId!, arg_resources!); @@ -2264,8 +2180,7 @@ class CustomViewCallbackHostApi { /// Handles Dart method `CustomViewCallback.onCustomViewHidden`. Future onCustomViewHidden(int arg_identifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden', - codec, + 'dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_identifier]) as List?; @@ -2299,8 +2214,7 @@ abstract class CustomViewCallbackFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int identifier); - static void setup(CustomViewCallbackFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(CustomViewCallbackFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CustomViewCallbackFlutterApi.create', codec, @@ -2310,7 +2224,7 @@ abstract class CustomViewCallbackFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CustomViewCallbackFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.CustomViewCallbackFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2322,3 +2236,39 @@ abstract class CustomViewCallbackFlutterApi { } } } + +/// Flutter API for `View`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.android.com/reference/android/view/View. +abstract class ViewFlutterApi { + static const MessageCodec codec = StandardMessageCodec(); + + /// Create a new Dart instance and add it to the `InstanceManager`. + void create(int identifier); + + static void setup(ViewFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.ViewFlutterApi.create', codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.ViewFlutterApi.create was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.ViewFlutterApi.create was null, expected non-null int.'); + api.create(arg_identifier!); + return; + }); + } + } + } +} diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart index 18c341424cf4..b7dd15e3cd03 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart @@ -48,6 +48,7 @@ class AndroidWebViewFlutterApis { WebViewFlutterApiImpl? webViewFlutterApi, PermissionRequestFlutterApiImpl? permissionRequestFlutterApi, CustomViewCallbackFlutterApiImpl? customViewCallbackFlutterApi, + ViewFlutterApiImpl? viewFlutterApi, }) { this.javaObjectFlutterApi = javaObjectFlutterApi ?? JavaObjectFlutterApiImpl(); @@ -66,6 +67,7 @@ class AndroidWebViewFlutterApis { permissionRequestFlutterApi ?? PermissionRequestFlutterApiImpl(); this.customViewCallbackFlutterApi = customViewCallbackFlutterApi ?? CustomViewCallbackFlutterApiImpl(); + this.viewFlutterApi = viewFlutterApi ?? ViewFlutterApiImpl(); } static bool _haveBeenSetUp = false; @@ -102,6 +104,9 @@ class AndroidWebViewFlutterApis { /// Flutter Api for [CustomViewCallback]. late final CustomViewCallbackFlutterApiImpl customViewCallbackFlutterApi; + /// Flutter Api for [View]. + late final ViewFlutterApiImpl viewFlutterApi; + /// Ensures all the Flutter APIs have been setup to receive calls from native code. void ensureSetUp() { if (!_haveBeenSetUp) { @@ -114,6 +119,7 @@ class AndroidWebViewFlutterApis { WebViewFlutterApi.setup(webViewFlutterApi); PermissionRequestFlutterApi.setup(permissionRequestFlutterApi); CustomViewCallbackFlutterApi.setup(customViewCallbackFlutterApi); + ViewFlutterApi.setup(viewFlutterApi); _haveBeenSetUp = true; } } @@ -1139,3 +1145,36 @@ class CustomViewCallbackFlutterApiImpl implements CustomViewCallbackFlutterApi { ); } } + +/// Flutter API implementation for [View]. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +class ViewFlutterApiImpl implements ViewFlutterApi { + /// Constructs a [ViewFlutterApiImpl]. + ViewFlutterApiImpl({ + this.binaryMessenger, + InstanceManager? instanceManager, + }) : instanceManager = instanceManager ?? JavaObject.globalInstanceManager; + + /// Receives binary data across the Flutter platform barrier. + /// + /// If it is null, the default BinaryMessenger will be used which routes to + /// the host platform. + final BinaryMessenger? binaryMessenger; + + /// Maintains instances stored to communicate with native language objects. + final InstanceManager instanceManager; + + @override + void create(int identifier) { + instanceManager.addHostCreatedInstance( + View.detached( + binaryMessenger: binaryMessenger, + instanceManager: instanceManager, + ), + identifier, + ); + } +} diff --git a/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart b/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart index 5d0401efed2b..8e2799a684d4 100644 --- a/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart +++ b/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart @@ -425,3 +425,16 @@ abstract class CustomViewCallbackFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int identifier); } + +/// Flutter API for `View`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.android.com/reference/android/view/View. +@FlutterApi() +abstract class ViewFlutterApi { + /// Create a new Dart instance and add it to the `InstanceManager`. + void create(int identifier); +} diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_test.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_test.dart index 70d8724db3eb..6d6ef3a8d69e 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_test.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_test.dart @@ -1053,7 +1053,6 @@ void main() { group('CustomViewCallback', () { tearDown(() { TestCustomViewCallbackHostApi.setup(null); - TestInstanceManagerHostApi.setup(null); }); test('onCustomViewHidden', () async { @@ -1096,6 +1095,27 @@ void main() { ); }); }); + + group('View', () { + test('FlutterAPI create', () { + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + + final ViewFlutterApiImpl api = ViewFlutterApiImpl( + instanceManager: instanceManager, + ); + + const int instanceIdentifier = 0; + + api.create(instanceIdentifier); + + expect( + instanceManager.getInstanceWithWeakReference(instanceIdentifier), + isA(), + ); + }); + }); }); group('CookieManager', () { From ba03b6b20258233dea13cc7378eaa59a0da70b17 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 30 May 2023 11:49:05 -0400 Subject: [PATCH 09/35] formatting --- .../CustomViewCallbackFlutterApiImpl.java | 21 +- .../CustomViewCallbackHostApiImpl.java | 56 +- .../GeneratedAndroidWebView.java | 895 +++++++++++------- .../webviewflutter/ViewFlutterApiImpl.java | 27 +- .../CustomViewCallbackTest.java | 87 +- .../plugins/webviewflutter/ViewTest.java | 40 +- .../lib/src/android_webview.g.dart | 399 +++++--- .../test/test_android_webview.g.dart | 687 +++++++++----- 8 files changed, 1307 insertions(+), 905 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackFlutterApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackFlutterApiImpl.java index aa5567d706ea..9627f0e995fe 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackFlutterApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackFlutterApiImpl.java @@ -7,14 +7,11 @@ package io.flutter.plugins.webviewflutter; - // TODO(bparrishMines): Import native classes -import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.CustomViewCallbackFlutterApi; import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import io.flutter.plugin.common.BinaryMessenger; -import java.util.Objects; +import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.CustomViewCallbackFlutterApi; /** * Flutter API implementation for `CustomViewCallback`. @@ -22,9 +19,8 @@ *

This class may handle adding native instances that are attached to a Dart instance or passing * arguments of callbacks methods to a Dart instance. */ - public class CustomViewCallbackFlutterApiImpl { - + // To ease adding additional methods, this value is added prematurely. @SuppressWarnings({"unused", "FieldCanBeLocal"}) private final BinaryMessenger binaryMessenger; @@ -47,23 +43,17 @@ public CustomViewCallbackFlutterApiImpl( /** * Stores the `CustomViewCallback` instance and notifies Dart to create and store a new - * `CustomViewCallback` instance that is attached to this one. If `instance` has already been added, - * this method does nothing. + * `CustomViewCallback` instance that is attached to this one. If `instance` has already been + * added, this method does nothing. */ public void create( @NonNull CustomViewCallback instance, - @NonNull CustomViewCallbackFlutterApi.Reply callback) { if (!instanceManager.containsInstance(instance)) { - api.create( - instanceManager.addHostCreatedInstance(instance), - - callback); + api.create(instanceManager.addHostCreatedInstance(instance), callback); } } - - /** * Sets the Flutter API used to send messages to Dart. * @@ -74,4 +64,3 @@ void setApi(@NonNull CustomViewCallbackFlutterApi api) { this.api = api; } } - diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackHostApiImpl.java index 4f2e0f053bd4..78d1296ce137 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackHostApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackHostApiImpl.java @@ -7,13 +7,10 @@ package io.flutter.plugins.webviewflutter; - // TODO(bparrishMines): Import native classes -import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.CustomViewCallbackHostApi; import androidx.annotation.NonNull; -import androidx.annotation.Nullable; -import androidx.annotation.VisibleForTesting; import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.CustomViewCallbackHostApi; import java.util.Objects; /** @@ -22,19 +19,13 @@ *

This class may handle instantiating and adding native object instances that are attached to a * Dart instance or handle method calls on the associated native class or an instance of the class. */ - public class CustomViewCallbackHostApiImpl implements CustomViewCallbackHostApi { - + // To ease adding additional methods, this value is added prematurely. @SuppressWarnings({"unused", "FieldCanBeLocal"}) private final BinaryMessenger binaryMessenger; private final InstanceManager instanceManager; - - - - - /** * Constructs a {@link CustomViewCallbackHostApiImpl}. @@ -44,55 +35,18 @@ public class CustomViewCallbackHostApiImpl implements CustomViewCallbackHostApi */ public CustomViewCallbackHostApiImpl( @NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { - + this.binaryMessenger = binaryMessenger; this.instanceManager = instanceManager; - - } - - - - - - - - - - @Override - public void onCustomViewHidden( - @NonNull Long identifier - ) { - - - - getCustomViewCallbackInstance(identifier) - .onCustomViewHidden( - - - - - - ); - + public void onCustomViewHidden(@NonNull Long identifier) { - - - - - - - - - + getCustomViewCallbackInstance(identifier).onCustomViewHidden(); } - - private CustomViewCallback getCustomViewCallbackInstance(@NonNull Long identifier) { return Objects.requireNonNull(instanceManager.getInstance(identifier)); } } - diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java index 831ed95d849d..cfb5c0ccc19a 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java @@ -18,7 +18,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -35,8 +34,7 @@ public static class FlutterError extends RuntimeException { /** The error details. Must be a datatype supported by the api codec. */ public final Object details; - public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) - { + public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) { super(message); this.code = code; this.details = details; @@ -55,7 +53,7 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); } return errorList; } @@ -63,26 +61,29 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { /** * Mode of how to select files for a file chooser. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. */ public enum FileChooserMode { /** - * Open single file and requires that the file exists before allowing the - * user to pick it. + * Open single file and requires that the file exists before allowing the user to pick it. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN. + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN. */ OPEN(0), /** * Similar to [open] but allows multiple files to be selected. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE. + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE. */ OPEN_MULTIPLE(1), /** * Allows picking a nonexistent file and saving it. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE. + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE. */ SAVE(2); @@ -374,7 +375,10 @@ ArrayList toList() { static @NonNull WebResourceErrorData fromList(@NonNull ArrayList list) { WebResourceErrorData pigeonResult = new WebResourceErrorData(); Object errorCode = list.get(0); - pigeonResult.setErrorCode((errorCode == null) ? null : ((errorCode instanceof Integer) ? (Integer) errorCode : (Long) errorCode)); + pigeonResult.setErrorCode( + (errorCode == null) + ? null + : ((errorCode instanceof Integer) ? (Integer) errorCode : (Long) errorCode)); Object description = list.get(1); pigeonResult.setDescription((String) description); return pigeonResult; @@ -463,13 +467,13 @@ public interface Result { /** * Host API for managing the native `InstanceManager`. * - * Generated interface from Pigeon that represents a handler of messages from Flutter. + *

Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface InstanceManagerHostApi { /** * Clear the native `InstanceManager`. * - * This is typically only used after a hot restart. + *

This is typically only used after a hot restart. */ void clear(); @@ -477,8 +481,12 @@ public interface InstanceManagerHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `InstanceManagerHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable InstanceManagerHostApi api) { + /** + * Sets up an instance of `InstanceManagerHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable InstanceManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -490,8 +498,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable InstanceMa try { api.clear(); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -506,11 +513,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable InstanceMa /** * Handles methods calls to the native Java Object class. * - * Also handles calls to remove the reference to an instance with `dispose`. + *

Also handles calls to remove the reference to an instance with `dispose`. * - * See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. + *

See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. * - * Generated interface from Pigeon that represents a handler of messages from Flutter. + *

Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface JavaObjectHostApi { @@ -520,7 +527,9 @@ public interface JavaObjectHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObjectHostApi api) { { BasicMessageChannel channel = @@ -535,8 +544,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObject try { api.dispose((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -551,9 +559,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObject /** * Handles callbacks methods for the native Java Object class. * - * See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. + *

See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. * - * Generated class from Pigeon that represents Flutter messages that can be called from Java. + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class JavaObjectFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -562,7 +570,7 @@ public JavaObjectFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -571,6 +579,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void dispose(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -583,11 +592,11 @@ public void dispose(@NonNull Long identifierArg, @NonNull Reply callback) /** * Host API for `CookieManager`. * - * This class may handle instantiating and adding native object instances that - * are attached to a Dart instance or handle method calls on the associated - * native class or an instance of the class. + *

This class may handle instantiating and adding native object instances that are attached to + * a Dart instance or handle method calls on the associated native class or an instance of the + * class. * - * Generated interface from Pigeon that represents a handler of messages from Flutter. + *

Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CookieManagerHostApi { /** Handles attaching `CookieManager.instance` to a native instance. */ @@ -597,18 +606,25 @@ public interface CookieManagerHostApi { /** Handles Dart method `CookieManager.removeAllCookies`. */ void removeAllCookies(@NonNull Long identifier, @NonNull Result result); /** Handles Dart method `CookieManager.setAcceptThirdPartyCookies`. */ - void setAcceptThirdPartyCookies(@NonNull Long identifier, @NonNull Long webViewIdentifier, @NonNull Boolean accept); + void setAcceptThirdPartyCookies( + @NonNull Long identifier, @NonNull Long webViewIdentifier, @NonNull Boolean accept); /** The codec used by CookieManagerHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `CookieManagerHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CookieManagerHostApi api) { + /** + * Sets up an instance of `CookieManagerHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable CookieManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.CookieManagerHostApi.attachInstance", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.CookieManagerHostApi.attachInstance", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -616,10 +632,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CookieMana ArrayList args = (ArrayList) message; Number instanceIdentifierArg = (Number) args.get(0); try { - api.attachInstance((instanceIdentifierArg == null) ? null : instanceIdentifierArg.longValue()); + api.attachInstance( + (instanceIdentifierArg == null) ? null : instanceIdentifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -642,10 +658,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CookieMana String urlArg = (String) args.get(1); String valueArg = (String) args.get(2); try { - api.setCookie((identifierArg == null) ? null : identifierArg.longValue(), urlArg, valueArg); + api.setCookie( + (identifierArg == null) ? null : identifierArg.longValue(), urlArg, valueArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -658,7 +674,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CookieMana { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -678,7 +696,8 @@ public void error(Throwable error) { } }; - api.removeAllCookies((identifierArg == null) ? null : identifierArg.longValue(), resultCallback); + api.removeAllCookies( + (identifierArg == null) ? null : identifierArg.longValue(), resultCallback); }); } else { channel.setMessageHandler(null); @@ -687,7 +706,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -697,10 +718,12 @@ public void error(Throwable error) { Number webViewIdentifierArg = (Number) args.get(1); Boolean acceptArg = (Boolean) args.get(2); try { - api.setAcceptThirdPartyCookies((identifierArg == null) ? null : identifierArg.longValue(), (webViewIdentifierArg == null) ? null : webViewIdentifierArg.longValue(), acceptArg); + api.setAcceptThirdPartyCookies( + (identifierArg == null) ? null : identifierArg.longValue(), + (webViewIdentifierArg == null) ? null : webViewIdentifierArg.longValue(), + acceptArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -744,21 +767,32 @@ public interface WebViewHostApi { void create(@NonNull Long instanceId); - void loadData(@NonNull Long instanceId, @NonNull String data, @Nullable String mimeType, @Nullable String encoding); + void loadData( + @NonNull Long instanceId, + @NonNull String data, + @Nullable String mimeType, + @Nullable String encoding); - void loadDataWithBaseUrl(@NonNull Long instanceId, @Nullable String baseUrl, @NonNull String data, @Nullable String mimeType, @Nullable String encoding, @Nullable String historyUrl); + void loadDataWithBaseUrl( + @NonNull Long instanceId, + @Nullable String baseUrl, + @NonNull String data, + @Nullable String mimeType, + @Nullable String encoding, + @Nullable String historyUrl); - void loadUrl(@NonNull Long instanceId, @NonNull String url, @NonNull Map headers); + void loadUrl( + @NonNull Long instanceId, @NonNull String url, @NonNull Map headers); void postUrl(@NonNull Long instanceId, @NonNull String url, @NonNull byte[] data); - @Nullable + @Nullable String getUrl(@NonNull Long instanceId); - @NonNull + @NonNull Boolean canGoBack(@NonNull Long instanceId); - @NonNull + @NonNull Boolean canGoForward(@NonNull Long instanceId); void goBack(@NonNull Long instanceId); @@ -769,22 +803,23 @@ public interface WebViewHostApi { void clearCache(@NonNull Long instanceId, @NonNull Boolean includeDiskFiles); - void evaluateJavascript(@NonNull Long instanceId, @NonNull String javascriptString, @NonNull Result result); + void evaluateJavascript( + @NonNull Long instanceId, @NonNull String javascriptString, @NonNull Result result); - @Nullable + @Nullable String getTitle(@NonNull Long instanceId); void scrollTo(@NonNull Long instanceId, @NonNull Long x, @NonNull Long y); void scrollBy(@NonNull Long instanceId, @NonNull Long x, @NonNull Long y); - @NonNull + @NonNull Long getScrollX(@NonNull Long instanceId); - @NonNull + @NonNull Long getScrollY(@NonNull Long instanceId); - @NonNull + @NonNull WebViewPoint getScrollPosition(@NonNull Long instanceId); void setWebContentsDebuggingEnabled(@NonNull Boolean enabled); @@ -793,7 +828,8 @@ public interface WebViewHostApi { void addJavaScriptChannel(@NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId); - void removeJavaScriptChannel(@NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId); + void removeJavaScriptChannel( + @NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId); void setDownloadListener(@NonNull Long instanceId, @Nullable Long listenerInstanceId); @@ -805,7 +841,7 @@ public interface WebViewHostApi { static @NonNull MessageCodec getCodec() { return WebViewHostApiCodec.INSTANCE; } - /**Sets up an instance of `WebViewHostApi` to handle messages through the `binaryMessenger`. */ + /** Sets up an instance of `WebViewHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHostApi api) { { BasicMessageChannel channel = @@ -820,8 +856,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -845,10 +880,13 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos String mimeTypeArg = (String) args.get(2); String encodingArg = (String) args.get(3); try { - api.loadData((instanceIdArg == null) ? null : instanceIdArg.longValue(), dataArg, mimeTypeArg, encodingArg); + api.loadData( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + dataArg, + mimeTypeArg, + encodingArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -861,7 +899,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -874,10 +914,15 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos String encodingArg = (String) args.get(4); String historyUrlArg = (String) args.get(5); try { - api.loadDataWithBaseUrl((instanceIdArg == null) ? null : instanceIdArg.longValue(), baseUrlArg, dataArg, mimeTypeArg, encodingArg, historyUrlArg); + api.loadDataWithBaseUrl( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + baseUrlArg, + dataArg, + mimeTypeArg, + encodingArg, + historyUrlArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -900,10 +945,12 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos String urlArg = (String) args.get(1); Map headersArg = (Map) args.get(2); try { - api.loadUrl((instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, headersArg); + api.loadUrl( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + urlArg, + headersArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -926,10 +973,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos String urlArg = (String) args.get(1); byte[] dataArg = (byte[]) args.get(2); try { - api.postUrl((instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, dataArg); + api.postUrl( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, dataArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -950,10 +997,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - String output = api.getUrl((instanceIdArg == null) ? null : instanceIdArg.longValue()); + String output = + api.getUrl((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -974,10 +1021,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - Boolean output = api.canGoBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); + Boolean output = + api.canGoBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -998,10 +1045,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - Boolean output = api.canGoForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); + Boolean output = + api.canGoForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1024,8 +1071,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos try { api.goBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1048,8 +1094,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos try { api.goForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1072,8 +1117,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos try { api.reload((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1095,10 +1139,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos Number instanceIdArg = (Number) args.get(0); Boolean includeDiskFilesArg = (Boolean) args.get(1); try { - api.clearCache((instanceIdArg == null) ? null : instanceIdArg.longValue(), includeDiskFilesArg); + api.clearCache( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + includeDiskFilesArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1111,7 +1156,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.evaluateJavascript", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.evaluateJavascript", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1132,7 +1179,10 @@ public void error(Throwable error) { } }; - api.evaluateJavascript((instanceIdArg == null) ? null : instanceIdArg.longValue(), javascriptStringArg, resultCallback); + api.evaluateJavascript( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + javascriptStringArg, + resultCallback); }); } else { channel.setMessageHandler(null); @@ -1149,10 +1199,10 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - String output = api.getTitle((instanceIdArg == null) ? null : instanceIdArg.longValue()); + String output = + api.getTitle((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1175,10 +1225,12 @@ public void error(Throwable error) { Number xArg = (Number) args.get(1); Number yArg = (Number) args.get(2); try { - api.scrollTo((instanceIdArg == null) ? null : instanceIdArg.longValue(), (xArg == null) ? null : xArg.longValue(), (yArg == null) ? null : yArg.longValue()); + api.scrollTo( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (xArg == null) ? null : xArg.longValue(), + (yArg == null) ? null : yArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1201,10 +1253,12 @@ public void error(Throwable error) { Number xArg = (Number) args.get(1); Number yArg = (Number) args.get(2); try { - api.scrollBy((instanceIdArg == null) ? null : instanceIdArg.longValue(), (xArg == null) ? null : xArg.longValue(), (yArg == null) ? null : yArg.longValue()); + api.scrollBy( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (xArg == null) ? null : xArg.longValue(), + (yArg == null) ? null : yArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1225,10 +1279,10 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - Long output = api.getScrollX((instanceIdArg == null) ? null : instanceIdArg.longValue()); + Long output = + api.getScrollX((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1249,10 +1303,10 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - Long output = api.getScrollY((instanceIdArg == null) ? null : instanceIdArg.longValue()); + Long output = + api.getScrollY((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1273,10 +1327,11 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - WebViewPoint output = api.getScrollPosition((instanceIdArg == null) ? null : instanceIdArg.longValue()); + WebViewPoint output = + api.getScrollPosition( + (instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1289,7 +1344,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1299,8 +1356,7 @@ public void error(Throwable error) { try { api.setWebContentsDebuggingEnabled(enabledArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1322,10 +1378,13 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number webViewClientInstanceIdArg = (Number) args.get(1); try { - api.setWebViewClient((instanceIdArg == null) ? null : instanceIdArg.longValue(), (webViewClientInstanceIdArg == null) ? null : webViewClientInstanceIdArg.longValue()); + api.setWebViewClient( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (webViewClientInstanceIdArg == null) + ? null + : webViewClientInstanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1338,7 +1397,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1347,10 +1408,13 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number javaScriptChannelInstanceIdArg = (Number) args.get(1); try { - api.addJavaScriptChannel((instanceIdArg == null) ? null : instanceIdArg.longValue(), (javaScriptChannelInstanceIdArg == null) ? null : javaScriptChannelInstanceIdArg.longValue()); + api.addJavaScriptChannel( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (javaScriptChannelInstanceIdArg == null) + ? null + : javaScriptChannelInstanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1363,7 +1427,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1372,10 +1438,13 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number javaScriptChannelInstanceIdArg = (Number) args.get(1); try { - api.removeJavaScriptChannel((instanceIdArg == null) ? null : instanceIdArg.longValue(), (javaScriptChannelInstanceIdArg == null) ? null : javaScriptChannelInstanceIdArg.longValue()); + api.removeJavaScriptChannel( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (javaScriptChannelInstanceIdArg == null) + ? null + : javaScriptChannelInstanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1388,7 +1457,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setDownloadListener", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.setDownloadListener", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1397,10 +1468,11 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number listenerInstanceIdArg = (Number) args.get(1); try { - api.setDownloadListener((instanceIdArg == null) ? null : instanceIdArg.longValue(), (listenerInstanceIdArg == null) ? null : listenerInstanceIdArg.longValue()); + api.setDownloadListener( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (listenerInstanceIdArg == null) ? null : listenerInstanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1413,7 +1485,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setWebChromeClient", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.setWebChromeClient", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1422,10 +1496,11 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number clientInstanceIdArg = (Number) args.get(1); try { - api.setWebChromeClient((instanceIdArg == null) ? null : instanceIdArg.longValue(), (clientInstanceIdArg == null) ? null : clientInstanceIdArg.longValue()); + api.setWebChromeClient( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (clientInstanceIdArg == null) ? null : clientInstanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1438,7 +1513,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setBackgroundColor", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.setBackgroundColor", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1447,10 +1524,11 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number colorArg = (Number) args.get(1); try { - api.setBackgroundColor((instanceIdArg == null) ? null : instanceIdArg.longValue(), (colorArg == null) ? null : colorArg.longValue()); + api.setBackgroundColor( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (colorArg == null) ? null : colorArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1465,13 +1543,12 @@ public void error(Throwable error) { /** * Flutter API for `WebView`. * - * This class may handle instantiating and adding Dart instances that are - * attached to a native instance or receiving callback methods from an - * overridden native class. + *

This class may handle instantiating and adding Dart instances that are attached to a native + * instance or receiving callback methods from an overridden native class. * - * See https://developer.android.com/reference/android/webkit/WebView. + *

See https://developer.android.com/reference/android/webkit/WebView. * - * Generated class from Pigeon that represents Flutter messages that can be called from Java. + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class WebViewFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -1480,7 +1557,7 @@ public WebViewFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1534,7 +1611,9 @@ public interface WebSettingsHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `WebSettingsHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `WebSettingsHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSettingsHostApi api) { { BasicMessageChannel channel = @@ -1548,10 +1627,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Number webViewInstanceIdArg = (Number) args.get(1); try { - api.create((instanceIdArg == null) ? null : instanceIdArg.longValue(), (webViewInstanceIdArg == null) ? null : webViewInstanceIdArg.longValue()); + api.create( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (webViewInstanceIdArg == null) ? null : webViewInstanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1564,7 +1644,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1573,10 +1655,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean flagArg = (Boolean) args.get(1); try { - api.setDomStorageEnabled((instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); + api.setDomStorageEnabled( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1589,7 +1671,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1598,10 +1682,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean flagArg = (Boolean) args.get(1); try { - api.setJavaScriptCanOpenWindowsAutomatically((instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); + api.setJavaScriptCanOpenWindowsAutomatically( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1614,7 +1698,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1623,10 +1709,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean supportArg = (Boolean) args.get(1); try { - api.setSupportMultipleWindows((instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); + api.setSupportMultipleWindows( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1639,7 +1725,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1648,10 +1736,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean flagArg = (Boolean) args.get(1); try { - api.setJavaScriptEnabled((instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); + api.setJavaScriptEnabled( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1664,7 +1752,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1673,10 +1763,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); String userAgentStringArg = (String) args.get(1); try { - api.setUserAgentString((instanceIdArg == null) ? null : instanceIdArg.longValue(), userAgentStringArg); + api.setUserAgentString( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + userAgentStringArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1689,7 +1780,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1698,10 +1791,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean requireArg = (Boolean) args.get(1); try { - api.setMediaPlaybackRequiresUserGesture((instanceIdArg == null) ? null : instanceIdArg.longValue(), requireArg); + api.setMediaPlaybackRequiresUserGesture( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), requireArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1714,7 +1807,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1723,10 +1818,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean supportArg = (Boolean) args.get(1); try { - api.setSupportZoom((instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); + api.setSupportZoom( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1739,7 +1834,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1748,10 +1845,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean overviewArg = (Boolean) args.get(1); try { - api.setLoadWithOverviewMode((instanceIdArg == null) ? null : instanceIdArg.longValue(), overviewArg); + api.setLoadWithOverviewMode( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), overviewArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1764,7 +1861,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1773,10 +1872,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean useArg = (Boolean) args.get(1); try { - api.setUseWideViewPort((instanceIdArg == null) ? null : instanceIdArg.longValue(), useArg); + api.setUseWideViewPort( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), useArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1789,7 +1888,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1798,10 +1899,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean enabledArg = (Boolean) args.get(1); try { - api.setDisplayZoomControls((instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); + api.setDisplayZoomControls( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1814,7 +1915,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1823,10 +1926,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean enabledArg = (Boolean) args.get(1); try { - api.setBuiltInZoomControls((instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); + api.setBuiltInZoomControls( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1839,7 +1942,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1848,10 +1953,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean enabledArg = (Boolean) args.get(1); try { - api.setAllowFileAccess((instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); + api.setAllowFileAccess( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1873,10 +1978,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Number textZoomArg = (Number) args.get(1); try { - api.setTextZoom((instanceIdArg == null) ? null : instanceIdArg.longValue(), (textZoomArg == null) ? null : textZoomArg.longValue()); + api.setTextZoom( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (textZoomArg == null) ? null : textZoomArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1897,8 +2003,12 @@ public interface JavaScriptChannelHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `JavaScriptChannelHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaScriptChannelHostApi api) { + /** + * Sets up an instance of `JavaScriptChannelHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable JavaScriptChannelHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1911,10 +2021,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaScript Number instanceIdArg = (Number) args.get(0); String channelNameArg = (String) args.get(1); try { - api.create((instanceIdArg == null) ? null : instanceIdArg.longValue(), channelNameArg); + api.create( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), channelNameArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1934,7 +2044,7 @@ public JavaScriptChannelFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1943,10 +2053,14 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void postMessage(@NonNull Long instanceIdArg, @NonNull String messageArg, @NonNull Reply callback) { + + public void postMessage( + @NonNull Long instanceIdArg, @NonNull String messageArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage", + getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, messageArg)), channelReply -> callback.reply(null)); @@ -1957,14 +2071,19 @@ public interface WebViewClientHostApi { void create(@NonNull Long instanceId); - void setSynchronousReturnValueForShouldOverrideUrlLoading(@NonNull Long instanceId, @NonNull Boolean value); + void setSynchronousReturnValueForShouldOverrideUrlLoading( + @NonNull Long instanceId, @NonNull Boolean value); /** The codec used by WebViewClientHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `WebViewClientHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewClientHostApi api) { + /** + * Sets up an instance of `WebViewClientHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable WebViewClientHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1978,8 +2097,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewCli try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1992,7 +2110,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewCli { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2001,10 +2121,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewCli Number instanceIdArg = (Number) args.get(0); Boolean valueArg = (Boolean) args.get(1); try { - api.setSynchronousReturnValueForShouldOverrideUrlLoading((instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); + api.setSynchronousReturnValueForShouldOverrideUrlLoading( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2056,7 +2176,7 @@ public WebViewClientFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2065,47 +2185,97 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return WebViewClientFlutterApiCodec.INSTANCE; } - public void onPageStarted(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Reply callback) { + + public void onPageStarted( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull String urlArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted", + getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), channelReply -> callback.reply(null)); } - public void onPageFinished(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Reply callback) { + + public void onPageFinished( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull String urlArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished", + getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), channelReply -> callback.reply(null)); } - public void onReceivedRequestError(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull WebResourceRequestData requestArg, @NonNull WebResourceErrorData errorArg, @NonNull Reply callback) { + + public void onReceivedRequestError( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull WebResourceRequestData requestArg, + @NonNull WebResourceErrorData errorArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError", + getCodec()); channel.send( - new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg, errorArg)), + new ArrayList( + Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg, errorArg)), channelReply -> callback.reply(null)); } - public void onReceivedError(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull Long errorCodeArg, @NonNull String descriptionArg, @NonNull String failingUrlArg, @NonNull Reply callback) { + + public void onReceivedError( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull Long errorCodeArg, + @NonNull String descriptionArg, + @NonNull String failingUrlArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError", + getCodec()); channel.send( - new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, errorCodeArg, descriptionArg, failingUrlArg)), + new ArrayList( + Arrays.asList( + instanceIdArg, + webViewInstanceIdArg, + errorCodeArg, + descriptionArg, + failingUrlArg)), channelReply -> callback.reply(null)); } - public void requestLoading(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull WebResourceRequestData requestArg, @NonNull Reply callback) { + + public void requestLoading( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull WebResourceRequestData requestArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading", + getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg)), channelReply -> callback.reply(null)); } - public void urlLoading(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Reply callback) { + + public void urlLoading( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull String urlArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading", getCodec()); @@ -2113,12 +2283,21 @@ public void urlLoading(@NonNull Long instanceIdArg, @NonNull Long webViewInstanc new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), channelReply -> callback.reply(null)); } - public void doUpdateVisitedHistory(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Boolean isReloadArg, @NonNull Reply callback) { + + public void doUpdateVisitedHistory( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull String urlArg, + @NonNull Boolean isReloadArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory", + getCodec()); channel.send( - new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg, isReloadArg)), + new ArrayList( + Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg, isReloadArg)), channelReply -> callback.reply(null)); } } @@ -2131,8 +2310,12 @@ public interface DownloadListenerHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `DownloadListenerHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DownloadListenerHostApi api) { + /** + * Sets up an instance of `DownloadListenerHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable DownloadListenerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2146,8 +2329,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DownloadLi try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2167,7 +2349,7 @@ public DownloadListenerFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2176,12 +2358,29 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void onDownloadStart(@NonNull Long instanceIdArg, @NonNull String urlArg, @NonNull String userAgentArg, @NonNull String contentDispositionArg, @NonNull String mimetypeArg, @NonNull Long contentLengthArg, @NonNull Reply callback) { + + public void onDownloadStart( + @NonNull Long instanceIdArg, + @NonNull String urlArg, + @NonNull String userAgentArg, + @NonNull String contentDispositionArg, + @NonNull String mimetypeArg, + @NonNull Long contentLengthArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart", + getCodec()); channel.send( - new ArrayList(Arrays.asList(instanceIdArg, urlArg, userAgentArg, contentDispositionArg, mimetypeArg, contentLengthArg)), + new ArrayList( + Arrays.asList( + instanceIdArg, + urlArg, + userAgentArg, + contentDispositionArg, + mimetypeArg, + contentLengthArg)), channelReply -> callback.reply(null)); } } @@ -2190,14 +2389,19 @@ public interface WebChromeClientHostApi { void create(@NonNull Long instanceId); - void setSynchronousReturnValueForOnShowFileChooser(@NonNull Long instanceId, @NonNull Boolean value); + void setSynchronousReturnValueForOnShowFileChooser( + @NonNull Long instanceId, @NonNull Boolean value); /** The codec used by WebChromeClientHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `WebChromeClientHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeClientHostApi api) { + /** + * Sets up an instance of `WebChromeClientHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeClientHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2211,8 +2415,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeC try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2225,7 +2428,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeC { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2234,10 +2439,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeC Number instanceIdArg = (Number) args.get(0); Boolean valueArg = (Boolean) args.get(1); try { - api.setSynchronousReturnValueForOnShowFileChooser((instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); + api.setSynchronousReturnValueForOnShowFileChooser( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2252,18 +2457,22 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeC /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface FlutterAssetManagerHostApi { - @NonNull + @NonNull List list(@NonNull String path); - @NonNull + @NonNull String getAssetFilePathByName(@NonNull String name); /** The codec used by FlutterAssetManagerHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `FlutterAssetManagerHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable FlutterAssetManagerHostApi api) { + /** + * Sets up an instance of `FlutterAssetManagerHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable FlutterAssetManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2277,8 +2486,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable FlutterAss try { List output = api.list(pathArg); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2291,7 +2499,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable FlutterAss { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2301,8 +2511,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable FlutterAss try { String output = api.getAssetFilePathByName(nameArg); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2322,7 +2531,7 @@ public WebChromeClientFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2331,20 +2540,35 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void onProgressChanged(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull Long progressArg, @NonNull Reply callback) { + + public void onProgressChanged( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull Long progressArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged", + getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, progressArg)), channelReply -> callback.reply(null)); } - public void onShowFileChooser(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull Long paramsInstanceIdArg, @NonNull Reply> callback) { + + public void onShowFileChooser( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull Long paramsInstanceIdArg, + @NonNull Reply> callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser", + getCodec()); channel.send( - new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, paramsInstanceIdArg)), + new ArrayList( + Arrays.asList(instanceIdArg, webViewInstanceIdArg, paramsInstanceIdArg)), channelReply -> { @SuppressWarnings("ConstantConditions") List output = (List) channelReply; @@ -2352,10 +2576,15 @@ public void onShowFileChooser(@NonNull Long instanceIdArg, @NonNull Long webView }); } /** Callback to Dart function `WebChromeClient.onPermissionRequest`. */ - public void onPermissionRequest(@NonNull Long instanceIdArg, @NonNull Long requestInstanceIdArg, @NonNull Reply callback) { + public void onPermissionRequest( + @NonNull Long instanceIdArg, + @NonNull Long requestInstanceIdArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest", + getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, requestInstanceIdArg)), channelReply -> callback.reply(null)); @@ -2372,7 +2601,9 @@ public interface WebStorageHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `WebStorageHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `WebStorageHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorageHostApi api) { { BasicMessageChannel channel = @@ -2387,8 +2618,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorage try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2411,8 +2641,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorage try { api.deleteAllData((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2426,7 +2655,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorage } private static class FileChooserParamsFlutterApiCodec extends StandardMessageCodec { - public static final FileChooserParamsFlutterApiCodec INSTANCE = new FileChooserParamsFlutterApiCodec(); + public static final FileChooserParamsFlutterApiCodec INSTANCE = + new FileChooserParamsFlutterApiCodec(); private FileChooserParamsFlutterApiCodec() {} @@ -2454,9 +2684,10 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { /** * Handles callbacks methods for the native Java FileChooserParams class. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. * - * Generated class from Pigeon that represents Flutter messages that can be called from Java. + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class FileChooserParamsFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2465,7 +2696,7 @@ public FileChooserParamsFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2474,25 +2705,34 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return FileChooserParamsFlutterApiCodec.INSTANCE; } - public void create(@NonNull Long instanceIdArg, @NonNull Boolean isCaptureEnabledArg, @NonNull List acceptTypesArg, @NonNull FileChooserModeEnumData modeArg, @Nullable String filenameHintArg, @NonNull Reply callback) { + + public void create( + @NonNull Long instanceIdArg, + @NonNull Boolean isCaptureEnabledArg, + @NonNull List acceptTypesArg, + @NonNull FileChooserModeEnumData modeArg, + @Nullable String filenameHintArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.FileChooserParamsFlutterApi.create", getCodec()); channel.send( - new ArrayList(Arrays.asList(instanceIdArg, isCaptureEnabledArg, acceptTypesArg, modeArg, filenameHintArg)), + new ArrayList( + Arrays.asList( + instanceIdArg, isCaptureEnabledArg, acceptTypesArg, modeArg, filenameHintArg)), channelReply -> callback.reply(null)); } } /** * Host API for `PermissionRequest`. * - * This class may handle instantiating and adding native object instances that - * are attached to a Dart instance or handle method calls on the associated - * native class or an instance of the class. + *

This class may handle instantiating and adding native object instances that are attached to + * a Dart instance or handle method calls on the associated native class or an instance of the + * class. * - * See https://developer.android.com/reference/android/webkit/PermissionRequest. + *

See https://developer.android.com/reference/android/webkit/PermissionRequest. * - * Generated interface from Pigeon that represents a handler of messages from Flutter. + *

Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface PermissionRequestHostApi { /** Handles Dart method `PermissionRequest.grant`. */ @@ -2504,8 +2744,12 @@ public interface PermissionRequestHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `PermissionRequestHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PermissionRequestHostApi api) { + /** + * Sets up an instance of `PermissionRequestHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable PermissionRequestHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2518,10 +2762,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable Permission Number instanceIdArg = (Number) args.get(0); List resourcesArg = (List) args.get(1); try { - api.grant((instanceIdArg == null) ? null : instanceIdArg.longValue(), resourcesArg); + api.grant( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), resourcesArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2544,8 +2788,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable Permission try { api.deny((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2560,13 +2803,12 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable Permission /** * Flutter API for `PermissionRequest`. * - * This class may handle instantiating and adding Dart instances that are - * attached to a native instance or receiving callback methods from an - * overridden native class. + *

This class may handle instantiating and adding Dart instances that are attached to a native + * instance or receiving callback methods from an overridden native class. * - * See https://developer.android.com/reference/android/webkit/PermissionRequest. + *

See https://developer.android.com/reference/android/webkit/PermissionRequest. * - * Generated class from Pigeon that represents Flutter messages that can be called from Java. + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class PermissionRequestFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2575,7 +2817,7 @@ public PermissionRequestFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2585,7 +2827,10 @@ public interface Reply { return new StandardMessageCodec(); } /** Create a new Dart instance and add it to the `InstanceManager`. */ - public void create(@NonNull Long instanceIdArg, @NonNull List resourcesArg, @NonNull Reply callback) { + public void create( + @NonNull Long instanceIdArg, + @NonNull List resourcesArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.PermissionRequestFlutterApi.create", getCodec()); @@ -2597,13 +2842,14 @@ public void create(@NonNull Long instanceIdArg, @NonNull List resourcesA /** * Host API for `CustomViewCallback`. * - * This class may handle instantiating and adding native object instances that - * are attached to a Dart instance or handle method calls on the associated - * native class or an instance of the class. + *

This class may handle instantiating and adding native object instances that are attached to + * a Dart instance or handle method calls on the associated native class or an instance of the + * class. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. * - * Generated interface from Pigeon that represents a handler of messages from Flutter. + *

Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CustomViewCallbackHostApi { /** Handles Dart method `CustomViewCallback.onCustomViewHidden`. */ @@ -2613,12 +2859,18 @@ public interface CustomViewCallbackHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `CustomViewCallbackHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CustomViewCallbackHostApi api) { + /** + * Sets up an instance of `CustomViewCallbackHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable CustomViewCallbackHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2626,10 +2878,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CustomView ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - api.onCustomViewHidden((identifierArg == null) ? null : identifierArg.longValue()); + api.onCustomViewHidden( + (identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2644,13 +2896,13 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CustomView /** * Flutter API for `CustomViewCallback`. * - * This class may handle instantiating and adding Dart instances that are - * attached to a native instance or receiving callback methods from an - * overridden native class. + *

This class may handle instantiating and adding Dart instances that are attached to a native + * instance or receiving callback methods from an overridden native class. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. * - * Generated class from Pigeon that represents Flutter messages that can be called from Java. + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class CustomViewCallbackFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2659,7 +2911,7 @@ public CustomViewCallbackFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2672,7 +2924,9 @@ public interface Reply { public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.CustomViewCallbackFlutterApi.create", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.CustomViewCallbackFlutterApi.create", + getCodec()); channel.send( new ArrayList(Collections.singletonList(identifierArg)), channelReply -> callback.reply(null)); @@ -2681,13 +2935,12 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { /** * Flutter API for `View`. * - * This class may handle instantiating and adding Dart instances that are - * attached to a native instance or receiving callback methods from an - * overridden native class. + *

This class may handle instantiating and adding Dart instances that are attached to a native + * instance or receiving callback methods from an overridden native class. * - * See https://developer.android.com/reference/android/view/View. + *

See https://developer.android.com/reference/android/view/View. * - * Generated class from Pigeon that represents Flutter messages that can be called from Java. + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class ViewFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2696,7 +2949,7 @@ public ViewFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewFlutterApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewFlutterApiImpl.java index 44a53acf786d..93bf5521aa43 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewFlutterApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewFlutterApiImpl.java @@ -7,14 +7,11 @@ package io.flutter.plugins.webviewflutter; - // TODO(bparrishMines): Import native classes -import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.ViewFlutterApi; import androidx.annotation.NonNull; -import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import io.flutter.plugin.common.BinaryMessenger; -import java.util.Objects; +import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.ViewFlutterApi; /** * Flutter API implementation for `View`. @@ -22,9 +19,8 @@ *

This class may handle adding native instances that are attached to a Dart instance or passing * arguments of callbacks methods to a Dart instance. */ - public class ViewFlutterApiImpl { - + // To ease adding additional methods, this value is added prematurely. @SuppressWarnings({"unused", "FieldCanBeLocal"}) private final BinaryMessenger binaryMessenger; @@ -46,24 +42,16 @@ public ViewFlutterApiImpl( } /** - * Stores the `View` instance and notifies Dart to create and store a new - * `View` instance that is attached to this one. If `instance` has already been added, - * this method does nothing. + * Stores the `View` instance and notifies Dart to create and store a new `View` instance that is + * attached to this one. If `instance` has already been added, this method does nothing. */ - public void create( - @NonNull View instance, - - @NonNull ViewFlutterApi.Reply callback) { + public void create(@NonNull View instance, @NonNull ViewFlutterApi.Reply callback) { + if (!instanceManager.containsInstance(instance)) { - api.create( - instanceManager.addHostCreatedInstance(instance), - - callback); + api.create(instanceManager.addHostCreatedInstance(instance), callback); } } - - /** * Sets the Flutter API used to send messages to Dart. * @@ -74,4 +62,3 @@ void setApi(@NonNull ViewFlutterApi api) { this.api = api; } } - diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CustomViewCallbackTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CustomViewCallbackTest.java index fa11864792bb..7105cd3185c9 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CustomViewCallbackTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CustomViewCallbackTest.java @@ -8,14 +8,12 @@ package io.flutter.plugins.webviewflutter; // TODO(bparrishMines): Import native classes -import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.CustomViewCallbackFlutterApi; import java.util.Objects; import org.junit.After; import org.junit.Before; @@ -25,26 +23,16 @@ import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; - -import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.CustomViewCallbackFlutterApi; - - public class CustomViewCallbackTest { - - @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); - + @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); - @Mock public CustomViewCallback mockCustomViewCallback; - @Mock public BinaryMessenger mockBinaryMessenger; @Mock public CustomViewCallbackFlutterApi mockFlutterApi; - - InstanceManager instanceManager; @Before @@ -57,65 +45,19 @@ public void tearDown() { instanceManager.close(); } - - - - - - - - @Test public void onCustomViewHidden() { - - final long instanceIdentifier = 0; instanceManager.addDartCreatedInstance(mockCustomViewCallback, instanceIdentifier); - - - - - - - - - - - - - final CustomViewCallbackHostApiImpl hostApi = - new CustomViewCallbackHostApiImpl( - mockBinaryMessenger, instanceManager ); - - - hostApi.onCustomViewHidden( - instanceIdentifier - - ); - - - - - + new CustomViewCallbackHostApiImpl(mockBinaryMessenger, instanceManager); - + hostApi.onCustomViewHidden(instanceIdentifier); - verify( mockCustomViewCallback ) - .onCustomViewHidden( - - ); - - - - - - + verify(mockCustomViewCallback).onCustomViewHidden(); } - - @Test public void flutterApiCreate() { @@ -123,22 +65,11 @@ public void flutterApiCreate() { new CustomViewCallbackFlutterApiImpl(mockBinaryMessenger, instanceManager); flutterApi.setApi(mockFlutterApi); - - - flutterApi.create( - mockCustomViewCallback, - - reply -> {}); + flutterApi.create(mockCustomViewCallback, reply -> {}); final long instanceIdentifier = - Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(mockCustomViewCallback)); - verify(mockFlutterApi) - .create( - eq(instanceIdentifier), - - any()); + Objects.requireNonNull( + instanceManager.getIdentifierForStrongReference(mockCustomViewCallback)); + verify(mockFlutterApi).create(eq(instanceIdentifier), any()); } - - } - diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java index e13b826cb2fc..dc64935a0093 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java @@ -8,14 +8,12 @@ package io.flutter.plugins.webviewflutter; // TODO(bparrishMines): Import native classes -import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; import io.flutter.plugin.common.BinaryMessenger; +import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.ViewFlutterApi; import java.util.Objects; import org.junit.After; import org.junit.Before; @@ -25,26 +23,16 @@ import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; - -import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.ViewFlutterApi; - - public class ViewTest { - - @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); - + @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); - @Mock public View mockView; - @Mock public BinaryMessenger mockBinaryMessenger; @Mock public ViewFlutterApi mockFlutterApi; - - InstanceManager instanceManager; @Before @@ -57,36 +45,16 @@ public void tearDown() { instanceManager.close(); } - - - - - - - - @Test public void flutterApiCreate() { final ViewFlutterApiImpl flutterApi = new ViewFlutterApiImpl(mockBinaryMessenger, instanceManager); flutterApi.setApi(mockFlutterApi); - - - flutterApi.create( - mockView, - - reply -> {}); + flutterApi.create(mockView, reply -> {}); final long instanceIdentifier = Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(mockView)); - verify(mockFlutterApi) - .create( - eq(instanceIdentifier), - - any()); + verify(mockFlutterApi).create(eq(instanceIdentifier), any()); } - - } - diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart index 8eb466c213dc..ddd4d5274943 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart @@ -20,10 +20,12 @@ enum FileChooserMode { /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN. open, + /// Similar to [open] but allows multiple files to be selected. /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE. openMultiple, + /// Allows picking a nonexistent file and saving it. /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE. @@ -92,7 +94,8 @@ class WebResourceRequestData { isRedirect: result[2] as bool?, hasGesture: result[3]! as bool, method: result[4]! as String, - requestHeaders: (result[5] as Map?)!.cast(), + requestHeaders: + (result[5] as Map?)!.cast(), ); } } @@ -167,8 +170,7 @@ class InstanceManagerHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.InstanceManagerHostApi.clear', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -232,7 +234,8 @@ abstract class JavaObjectFlutterApi { void dispose(int identifier); - static void setup(JavaObjectFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(JavaObjectFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaObjectFlutterApi.dispose', codec, @@ -242,7 +245,7 @@ abstract class JavaObjectFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -294,12 +297,13 @@ class CookieManagerHostApi { } /// Handles Dart method `CookieManager.setCookie`. - Future setCookie(int arg_identifier, String arg_url, String arg_value) async { + Future setCookie( + int arg_identifier, String arg_url, String arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CookieManagerHostApi.setCookie', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_url, arg_value]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_url, arg_value]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -345,12 +349,15 @@ class CookieManagerHostApi { } /// Handles Dart method `CookieManager.setAcceptThirdPartyCookies`. - Future setAcceptThirdPartyCookies(int arg_identifier, int arg_webViewIdentifier, bool arg_accept) async { + Future setAcceptThirdPartyCookies( + int arg_identifier, int arg_webViewIdentifier, bool arg_accept) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies', codec, + 'dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_webViewIdentifier, arg_accept]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_webViewIdentifier, arg_accept]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -383,7 +390,7 @@ class _WebViewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebViewPoint.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -423,12 +430,14 @@ class WebViewHostApi { } } - Future loadData(int arg_instanceId, String arg_data, String? arg_mimeType, String? arg_encoding) async { + Future loadData(int arg_instanceId, String arg_data, + String? arg_mimeType, String? arg_encoding) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.loadData', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_data, arg_mimeType, arg_encoding]) as List?; + final List? replyList = await channel.send( + [arg_instanceId, arg_data, arg_mimeType, arg_encoding]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -445,12 +454,24 @@ class WebViewHostApi { } } - Future loadDataWithBaseUrl(int arg_instanceId, String? arg_baseUrl, String arg_data, String? arg_mimeType, String? arg_encoding, String? arg_historyUrl) async { + Future loadDataWithBaseUrl( + int arg_instanceId, + String? arg_baseUrl, + String arg_data, + String? arg_mimeType, + String? arg_encoding, + String? arg_historyUrl) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_baseUrl, arg_data, arg_mimeType, arg_encoding, arg_historyUrl]) as List?; + final List? replyList = await channel.send([ + arg_instanceId, + arg_baseUrl, + arg_data, + arg_mimeType, + arg_encoding, + arg_historyUrl + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -467,12 +488,14 @@ class WebViewHostApi { } } - Future loadUrl(int arg_instanceId, String arg_url, Map arg_headers) async { + Future loadUrl(int arg_instanceId, String arg_url, + Map arg_headers) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.loadUrl', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_url, arg_headers]) as List?; + await channel.send([arg_instanceId, arg_url, arg_headers]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -489,12 +512,13 @@ class WebViewHostApi { } } - Future postUrl(int arg_instanceId, String arg_url, Uint8List arg_data) async { + Future postUrl( + int arg_instanceId, String arg_url, Uint8List arg_data) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.postUrl', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_url, arg_data]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_url, arg_data]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -658,7 +682,8 @@ class WebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.clearCache', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_includeDiskFiles]) as List?; + await channel.send([arg_instanceId, arg_includeDiskFiles]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -675,12 +700,14 @@ class WebViewHostApi { } } - Future evaluateJavascript(int arg_instanceId, String arg_javascriptString) async { + Future evaluateJavascript( + int arg_instanceId, String arg_javascriptString) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.evaluateJavascript', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_javascriptString]) as List?; + await channel.send([arg_instanceId, arg_javascriptString]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -723,8 +750,8 @@ class WebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.scrollTo', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_x, arg_y]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_x, arg_y]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -745,8 +772,8 @@ class WebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.scrollBy', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_x, arg_y]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_x, arg_y]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -846,7 +873,8 @@ class WebViewHostApi { Future setWebContentsDebuggingEnabled(bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', codec, + 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_enabled]) as List?; @@ -866,12 +894,14 @@ class WebViewHostApi { } } - Future setWebViewClient(int arg_instanceId, int arg_webViewClientInstanceId) async { + Future setWebViewClient( + int arg_instanceId, int arg_webViewClientInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setWebViewClient', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_webViewClientInstanceId]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_webViewClientInstanceId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -888,12 +918,14 @@ class WebViewHostApi { } } - Future addJavaScriptChannel(int arg_instanceId, int arg_javaScriptChannelInstanceId) async { + Future addJavaScriptChannel( + int arg_instanceId, int arg_javaScriptChannelInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_javaScriptChannelInstanceId]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_javaScriptChannelInstanceId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -910,12 +942,14 @@ class WebViewHostApi { } } - Future removeJavaScriptChannel(int arg_instanceId, int arg_javaScriptChannelInstanceId) async { + Future removeJavaScriptChannel( + int arg_instanceId, int arg_javaScriptChannelInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_javaScriptChannelInstanceId]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_javaScriptChannelInstanceId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -932,12 +966,14 @@ class WebViewHostApi { } } - Future setDownloadListener(int arg_instanceId, int? arg_listenerInstanceId) async { + Future setDownloadListener( + int arg_instanceId, int? arg_listenerInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setDownloadListener', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_listenerInstanceId]) as List?; + await channel.send([arg_instanceId, arg_listenerInstanceId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -954,12 +990,14 @@ class WebViewHostApi { } } - Future setWebChromeClient(int arg_instanceId, int? arg_clientInstanceId) async { + Future setWebChromeClient( + int arg_instanceId, int? arg_clientInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setWebChromeClient', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_clientInstanceId]) as List?; + await channel.send([arg_instanceId, arg_clientInstanceId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -980,8 +1018,8 @@ class WebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setBackgroundColor', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_color]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_color]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1012,7 +1050,8 @@ abstract class WebViewFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int identifier); - static void setup(WebViewFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(WebViewFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewFlutterApi.create', codec, @@ -1022,7 +1061,7 @@ abstract class WebViewFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebViewFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1050,7 +1089,8 @@ class WebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.create', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_webViewInstanceId]) as List?; + await channel.send([arg_instanceId, arg_webViewInstanceId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1071,8 +1111,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_flag]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_flag]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1089,12 +1129,14 @@ class WebSettingsHostApi { } } - Future setJavaScriptCanOpenWindowsAutomatically(int arg_instanceId, bool arg_flag) async { + Future setJavaScriptCanOpenWindowsAutomatically( + int arg_instanceId, bool arg_flag) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_flag]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_flag]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1111,12 +1153,14 @@ class WebSettingsHostApi { } } - Future setSupportMultipleWindows(int arg_instanceId, bool arg_support) async { + Future setSupportMultipleWindows( + int arg_instanceId, bool arg_support) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_support]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_support]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1137,8 +1181,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_flag]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_flag]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1155,12 +1199,13 @@ class WebSettingsHostApi { } } - Future setUserAgentString(int arg_instanceId, String? arg_userAgentString) async { + Future setUserAgentString( + int arg_instanceId, String? arg_userAgentString) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_userAgentString]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_userAgentString]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1177,12 +1222,14 @@ class WebSettingsHostApi { } } - Future setMediaPlaybackRequiresUserGesture(int arg_instanceId, bool arg_require) async { + Future setMediaPlaybackRequiresUserGesture( + int arg_instanceId, bool arg_require) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_require]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_require]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1203,8 +1250,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_support]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_support]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1221,12 +1268,13 @@ class WebSettingsHostApi { } } - Future setLoadWithOverviewMode(int arg_instanceId, bool arg_overview) async { + Future setLoadWithOverviewMode( + int arg_instanceId, bool arg_overview) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_overview]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_overview]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1247,8 +1295,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_use]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_use]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1265,12 +1313,13 @@ class WebSettingsHostApi { } } - Future setDisplayZoomControls(int arg_instanceId, bool arg_enabled) async { + Future setDisplayZoomControls( + int arg_instanceId, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_enabled]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1287,12 +1336,13 @@ class WebSettingsHostApi { } } - Future setBuiltInZoomControls(int arg_instanceId, bool arg_enabled) async { + Future setBuiltInZoomControls( + int arg_instanceId, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_enabled]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1313,8 +1363,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_enabled]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1335,8 +1385,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setTextZoom', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_textZoom]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_textZoom]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1368,8 +1418,8 @@ class JavaScriptChannelHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_channelName]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_channelName]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1392,7 +1442,8 @@ abstract class JavaScriptChannelFlutterApi { void postMessage(int instanceId, String message); - static void setup(JavaScriptChannelFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(JavaScriptChannelFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage', codec, @@ -1402,7 +1453,7 @@ abstract class JavaScriptChannelFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage was null.'); + 'Argument for dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1450,12 +1501,14 @@ class WebViewClientHostApi { } } - Future setSynchronousReturnValueForShouldOverrideUrlLoading(int arg_instanceId, bool arg_value) async { + Future setSynchronousReturnValueForShouldOverrideUrlLoading( + int arg_instanceId, bool arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', codec, + 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_value]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_value]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1491,9 +1544,9 @@ class _WebViewClientFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebResourceErrorData.decode(readValue(buffer)!); - case 129: + case 129: return WebResourceRequestData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1508,17 +1561,22 @@ abstract class WebViewClientFlutterApi { void onPageFinished(int instanceId, int webViewInstanceId, String url); - void onReceivedRequestError(int instanceId, int webViewInstanceId, WebResourceRequestData request, WebResourceErrorData error); + void onReceivedRequestError(int instanceId, int webViewInstanceId, + WebResourceRequestData request, WebResourceErrorData error); - void onReceivedError(int instanceId, int webViewInstanceId, int errorCode, String description, String failingUrl); + void onReceivedError(int instanceId, int webViewInstanceId, int errorCode, + String description, String failingUrl); - void requestLoading(int instanceId, int webViewInstanceId, WebResourceRequestData request); + void requestLoading( + int instanceId, int webViewInstanceId, WebResourceRequestData request); void urlLoading(int instanceId, int webViewInstanceId, String url); - void doUpdateVisitedHistory(int instanceId, int webViewInstanceId, String url, bool isReload); + void doUpdateVisitedHistory( + int instanceId, int webViewInstanceId, String url, bool isReload); - static void setup(WebViewClientFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(WebViewClientFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted', codec, @@ -1528,7 +1586,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1553,7 +1611,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1571,14 +1629,15 @@ abstract class WebViewClientFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError', codec, + 'dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1586,13 +1645,16 @@ abstract class WebViewClientFlutterApi { final int? arg_webViewInstanceId = (args[1] as int?); assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null int.'); - final WebResourceRequestData? arg_request = (args[2] as WebResourceRequestData?); + final WebResourceRequestData? arg_request = + (args[2] as WebResourceRequestData?); assert(arg_request != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null WebResourceRequestData.'); - final WebResourceErrorData? arg_error = (args[3] as WebResourceErrorData?); + final WebResourceErrorData? arg_error = + (args[3] as WebResourceErrorData?); assert(arg_error != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null WebResourceErrorData.'); - api.onReceivedRequestError(arg_instanceId!, arg_webViewInstanceId!, arg_request!, arg_error!); + api.onReceivedRequestError(arg_instanceId!, arg_webViewInstanceId!, + arg_request!, arg_error!); return; }); } @@ -1606,7 +1668,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1623,7 +1685,8 @@ abstract class WebViewClientFlutterApi { final String? arg_failingUrl = (args[4] as String?); assert(arg_failingUrl != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null String.'); - api.onReceivedError(arg_instanceId!, arg_webViewInstanceId!, arg_errorCode!, arg_description!, arg_failingUrl!); + api.onReceivedError(arg_instanceId!, arg_webViewInstanceId!, + arg_errorCode!, arg_description!, arg_failingUrl!); return; }); } @@ -1637,7 +1700,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1645,10 +1708,12 @@ abstract class WebViewClientFlutterApi { final int? arg_webViewInstanceId = (args[1] as int?); assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null, expected non-null int.'); - final WebResourceRequestData? arg_request = (args[2] as WebResourceRequestData?); + final WebResourceRequestData? arg_request = + (args[2] as WebResourceRequestData?); assert(arg_request != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null, expected non-null WebResourceRequestData.'); - api.requestLoading(arg_instanceId!, arg_webViewInstanceId!, arg_request!); + api.requestLoading( + arg_instanceId!, arg_webViewInstanceId!, arg_request!); return; }); } @@ -1662,7 +1727,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1680,14 +1745,15 @@ abstract class WebViewClientFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory', codec, + 'dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1701,7 +1767,8 @@ abstract class WebViewClientFlutterApi { final bool? arg_isReload = (args[3] as bool?); assert(arg_isReload != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null, expected non-null bool.'); - api.doUpdateVisitedHistory(arg_instanceId!, arg_webViewInstanceId!, arg_url!, arg_isReload!); + api.doUpdateVisitedHistory( + arg_instanceId!, arg_webViewInstanceId!, arg_url!, arg_isReload!); return; }); } @@ -1745,19 +1812,22 @@ class DownloadListenerHostApi { abstract class DownloadListenerFlutterApi { static const MessageCodec codec = StandardMessageCodec(); - void onDownloadStart(int instanceId, String url, String userAgent, String contentDisposition, String mimetype, int contentLength); + void onDownloadStart(int instanceId, String url, String userAgent, + String contentDisposition, String mimetype, int contentLength); - static void setup(DownloadListenerFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(DownloadListenerFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart', codec, + 'dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null.'); + 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1777,7 +1847,8 @@ abstract class DownloadListenerFlutterApi { final int? arg_contentLength = (args[5] as int?); assert(arg_contentLength != null, 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null int.'); - api.onDownloadStart(arg_instanceId!, arg_url!, arg_userAgent!, arg_contentDisposition!, arg_mimetype!, arg_contentLength!); + api.onDownloadStart(arg_instanceId!, arg_url!, arg_userAgent!, + arg_contentDisposition!, arg_mimetype!, arg_contentLength!); return; }); } @@ -1817,12 +1888,14 @@ class WebChromeClientHostApi { } } - Future setSynchronousReturnValueForOnShowFileChooser(int arg_instanceId, bool arg_value) async { + Future setSynchronousReturnValueForOnShowFileChooser( + int arg_instanceId, bool arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', codec, + 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_value]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_value]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1879,7 +1952,8 @@ class FlutterAssetManagerHostApi { Future getAssetFilePathByName(String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', codec, + 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_name]) as List?; @@ -1910,22 +1984,25 @@ abstract class WebChromeClientFlutterApi { void onProgressChanged(int instanceId, int webViewInstanceId, int progress); - Future> onShowFileChooser(int instanceId, int webViewInstanceId, int paramsInstanceId); + Future> onShowFileChooser( + int instanceId, int webViewInstanceId, int paramsInstanceId); /// Callback to Dart function `WebChromeClient.onPermissionRequest`. void onPermissionRequest(int instanceId, int requestInstanceId); - static void setup(WebChromeClientFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(WebChromeClientFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged', codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1936,21 +2013,23 @@ abstract class WebChromeClientFlutterApi { final int? arg_progress = (args[2] as int?); assert(arg_progress != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null, expected non-null int.'); - api.onProgressChanged(arg_instanceId!, arg_webViewInstanceId!, arg_progress!); + api.onProgressChanged( + arg_instanceId!, arg_webViewInstanceId!, arg_progress!); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser', codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1961,21 +2040,23 @@ abstract class WebChromeClientFlutterApi { final int? arg_paramsInstanceId = (args[2] as int?); assert(arg_paramsInstanceId != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null, expected non-null int.'); - final List output = await api.onShowFileChooser(arg_instanceId!, arg_webViewInstanceId!, arg_paramsInstanceId!); + final List output = await api.onShowFileChooser( + arg_instanceId!, arg_webViewInstanceId!, arg_paramsInstanceId!); return output; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest', codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -2061,7 +2142,7 @@ class _FileChooserParamsFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return FileChooserModeEnumData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -2073,11 +2154,14 @@ class _FileChooserParamsFlutterApiCodec extends StandardMessageCodec { /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. abstract class FileChooserParamsFlutterApi { - static const MessageCodec codec = _FileChooserParamsFlutterApiCodec(); + static const MessageCodec codec = + _FileChooserParamsFlutterApiCodec(); - void create(int instanceId, bool isCaptureEnabled, List acceptTypes, FileChooserModeEnumData mode, String? filenameHint); + void create(int instanceId, bool isCaptureEnabled, List acceptTypes, + FileChooserModeEnumData mode, String? filenameHint); - static void setup(FileChooserParamsFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(FileChooserParamsFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FileChooserParamsFlutterApi.create', codec, @@ -2087,7 +2171,7 @@ abstract class FileChooserParamsFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -2095,14 +2179,17 @@ abstract class FileChooserParamsFlutterApi { final bool? arg_isCaptureEnabled = (args[1] as bool?); assert(arg_isCaptureEnabled != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null bool.'); - final List? arg_acceptTypes = (args[2] as List?)?.cast(); + final List? arg_acceptTypes = + (args[2] as List?)?.cast(); assert(arg_acceptTypes != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null List.'); - final FileChooserModeEnumData? arg_mode = (args[3] as FileChooserModeEnumData?); + final FileChooserModeEnumData? arg_mode = + (args[3] as FileChooserModeEnumData?); assert(arg_mode != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null FileChooserModeEnumData.'); final String? arg_filenameHint = (args[4] as String?); - api.create(arg_instanceId!, arg_isCaptureEnabled!, arg_acceptTypes!, arg_mode!, arg_filenameHint); + api.create(arg_instanceId!, arg_isCaptureEnabled!, arg_acceptTypes!, + arg_mode!, arg_filenameHint); return; }); } @@ -2132,8 +2219,8 @@ class PermissionRequestHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PermissionRequestHostApi.grant', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_resources]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_resources]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2187,7 +2274,8 @@ abstract class PermissionRequestFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int instanceId, List resources); - static void setup(PermissionRequestFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(PermissionRequestFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PermissionRequestFlutterApi.create', codec, @@ -2197,12 +2285,13 @@ abstract class PermissionRequestFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PermissionRequestFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.PermissionRequestFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.PermissionRequestFlutterApi.create was null, expected non-null int.'); - final List? arg_resources = (args[1] as List?)?.cast(); + final List? arg_resources = + (args[1] as List?)?.cast(); assert(arg_resources != null, 'Argument for dev.flutter.pigeon.PermissionRequestFlutterApi.create was null, expected non-null List.'); api.create(arg_instanceId!, arg_resources!); @@ -2233,7 +2322,8 @@ class CustomViewCallbackHostApi { /// Handles Dart method `CustomViewCallback.onCustomViewHidden`. Future onCustomViewHidden(int arg_identifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden', codec, + 'dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_identifier]) as List?; @@ -2267,7 +2357,8 @@ abstract class CustomViewCallbackFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int identifier); - static void setup(CustomViewCallbackFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(CustomViewCallbackFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CustomViewCallbackFlutterApi.create', codec, @@ -2277,7 +2368,7 @@ abstract class CustomViewCallbackFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CustomViewCallbackFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.CustomViewCallbackFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2313,7 +2404,7 @@ abstract class ViewFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ViewFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.ViewFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, diff --git a/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart index 0306fbffb5e5..dc4e4bce860c 100644 --- a/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart +++ b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart @@ -15,7 +15,8 @@ import 'package:webview_flutter_android/src/android_webview.g.dart'; /// Host API for managing the native `InstanceManager`. abstract class TestInstanceManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Clear the native `InstanceManager`. @@ -23,15 +24,19 @@ abstract class TestInstanceManagerHostApi { /// This is typically only used after a hot restart. void clear(); - static void setup(TestInstanceManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestInstanceManagerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.InstanceManagerHostApi.clear', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { // ignore message api.clear(); return []; @@ -47,22 +52,27 @@ abstract class TestInstanceManagerHostApi { /// /// See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. abstract class TestJavaObjectHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void dispose(int identifier); - static void setup(TestJavaObjectHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestJavaObjectHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaObjectHostApi.dispose', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -81,7 +91,8 @@ abstract class TestJavaObjectHostApi { /// are attached to a Dart instance or handle method calls on the associated /// native class or an instance of the class. abstract class TestCookieManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Handles attaching `CookieManager.instance` to a native instance. @@ -94,19 +105,24 @@ abstract class TestCookieManagerHostApi { Future removeAllCookies(int identifier); /// Handles Dart method `CookieManager.setAcceptThirdPartyCookies`. - void setAcceptThirdPartyCookies(int identifier, int webViewIdentifier, bool accept); + void setAcceptThirdPartyCookies( + int identifier, int webViewIdentifier, bool accept); - static void setup(TestCookieManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestCookieManagerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CookieManagerHostApi.attachInstance', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CookieManagerHostApi.attachInstance was null.'); + 'Argument for dev.flutter.pigeon.CookieManagerHostApi.attachInstance was null.'); final List args = (message as List?)!; final int? arg_instanceIdentifier = (args[0] as int?); assert(arg_instanceIdentifier != null, @@ -121,11 +137,14 @@ abstract class TestCookieManagerHostApi { 'dev.flutter.pigeon.CookieManagerHostApi.setCookie', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setCookie was null.'); + 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setCookie was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -146,11 +165,14 @@ abstract class TestCookieManagerHostApi { 'dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies was null.'); + 'Argument for dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -162,14 +184,18 @@ abstract class TestCookieManagerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies', codec, + 'dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies was null.'); + 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -180,7 +206,8 @@ abstract class TestCookieManagerHostApi { final bool? arg_accept = (args[2] as bool?); assert(arg_accept != null, 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies was null, expected non-null bool.'); - api.setAcceptThirdPartyCookies(arg_identifier!, arg_webViewIdentifier!, arg_accept!); + api.setAcceptThirdPartyCookies( + arg_identifier!, arg_webViewIdentifier!, arg_accept!); return []; }); } @@ -203,7 +230,7 @@ class _TestWebViewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebViewPoint.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -212,14 +239,17 @@ class _TestWebViewHostApiCodec extends StandardMessageCodec { } abstract class TestWebViewHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestWebViewHostApiCodec(); void create(int instanceId); - void loadData(int instanceId, String data, String? mimeType, String? encoding); + void loadData( + int instanceId, String data, String? mimeType, String? encoding); - void loadDataWithBaseUrl(int instanceId, String? baseUrl, String data, String? mimeType, String? encoding, String? historyUrl); + void loadDataWithBaseUrl(int instanceId, String? baseUrl, String data, + String? mimeType, String? encoding, String? historyUrl); void loadUrl(int instanceId, String url, Map headers); @@ -267,17 +297,21 @@ abstract class TestWebViewHostApi { void setBackgroundColor(int instanceId, int color); - static void setup(TestWebViewHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebViewHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -292,11 +326,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.loadData', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -316,11 +353,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -332,7 +372,8 @@ abstract class TestWebViewHostApi { final String? arg_mimeType = (args[3] as String?); final String? arg_encoding = (args[4] as String?); final String? arg_historyUrl = (args[5] as String?); - api.loadDataWithBaseUrl(arg_instanceId!, arg_baseUrl, arg_data!, arg_mimeType, arg_encoding, arg_historyUrl); + api.loadDataWithBaseUrl(arg_instanceId!, arg_baseUrl, arg_data!, + arg_mimeType, arg_encoding, arg_historyUrl); return []; }); } @@ -342,11 +383,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.loadUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -354,7 +398,8 @@ abstract class TestWebViewHostApi { final String? arg_url = (args[1] as String?); assert(arg_url != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null String.'); - final Map? arg_headers = (args[2] as Map?)?.cast(); + final Map? arg_headers = + (args[2] as Map?)?.cast(); assert(arg_headers != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null Map.'); api.loadUrl(arg_instanceId!, arg_url!, arg_headers!); @@ -367,11 +412,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.postUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -392,11 +440,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -411,11 +462,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.canGoBack', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoBack was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -430,11 +484,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.canGoForward', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoForward was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -449,11 +506,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.goBack', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.goBack was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.goBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -468,11 +528,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.goForward', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.goForward was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.goForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -487,11 +550,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.reload', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.reload was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.reload was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -506,11 +572,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.clearCache', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -528,11 +597,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.evaluateJavascript', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -540,7 +612,8 @@ abstract class TestWebViewHostApi { final String? arg_javascriptString = (args[1] as String?); assert(arg_javascriptString != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null, expected non-null String.'); - final String? output = await api.evaluateJavascript(arg_instanceId!, arg_javascriptString!); + final String? output = await api.evaluateJavascript( + arg_instanceId!, arg_javascriptString!); return [output]; }); } @@ -550,11 +623,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getTitle', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getTitle was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getTitle was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -569,11 +645,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.scrollTo', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -594,11 +673,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.scrollBy', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -619,11 +701,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getScrollX', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollX was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollX was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -638,11 +723,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getScrollY', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollY was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollY was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -657,11 +745,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getScrollPosition', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollPosition was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollPosition was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -673,14 +764,18 @@ abstract class TestWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', codec, + 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled was null.'); final List args = (message as List?)!; final bool? arg_enabled = (args[0] as bool?); assert(arg_enabled != null, @@ -695,11 +790,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setWebViewClient', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -717,11 +815,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -729,7 +830,8 @@ abstract class TestWebViewHostApi { final int? arg_javaScriptChannelInstanceId = (args[1] as int?); assert(arg_javaScriptChannelInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null, expected non-null int.'); - api.addJavaScriptChannel(arg_instanceId!, arg_javaScriptChannelInstanceId!); + api.addJavaScriptChannel( + arg_instanceId!, arg_javaScriptChannelInstanceId!); return []; }); } @@ -739,11 +841,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -751,7 +856,8 @@ abstract class TestWebViewHostApi { final int? arg_javaScriptChannelInstanceId = (args[1] as int?); assert(arg_javaScriptChannelInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null, expected non-null int.'); - api.removeJavaScriptChannel(arg_instanceId!, arg_javaScriptChannelInstanceId!); + api.removeJavaScriptChannel( + arg_instanceId!, arg_javaScriptChannelInstanceId!); return []; }); } @@ -761,11 +867,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setDownloadListener', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -781,11 +890,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setWebChromeClient', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -801,11 +913,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setBackgroundColor', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -822,7 +937,8 @@ abstract class TestWebViewHostApi { } abstract class TestWebSettingsHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId, int webViewInstanceId); @@ -853,17 +969,21 @@ abstract class TestWebSettingsHostApi { void setTextZoom(int instanceId, int textZoom); - static void setup(TestWebSettingsHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebSettingsHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -881,11 +1001,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -900,14 +1023,18 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -915,21 +1042,26 @@ abstract class TestWebSettingsHostApi { final bool? arg_flag = (args[1] as bool?); assert(arg_flag != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null, expected non-null bool.'); - api.setJavaScriptCanOpenWindowsAutomatically(arg_instanceId!, arg_flag!); + api.setJavaScriptCanOpenWindowsAutomatically( + arg_instanceId!, arg_flag!); return []; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -947,11 +1079,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -969,11 +1104,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -986,14 +1124,18 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1001,7 +1143,8 @@ abstract class TestWebSettingsHostApi { final bool? arg_require = (args[1] as bool?); assert(arg_require != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null, expected non-null bool.'); - api.setMediaPlaybackRequiresUserGesture(arg_instanceId!, arg_require!); + api.setMediaPlaybackRequiresUserGesture( + arg_instanceId!, arg_require!); return []; }); } @@ -1011,11 +1154,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1030,14 +1176,18 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1055,11 +1205,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1077,11 +1230,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1099,11 +1255,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1121,11 +1280,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1143,11 +1305,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setTextZoom', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setTextZoom was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setTextZoom was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1164,22 +1329,27 @@ abstract class TestWebSettingsHostApi { } abstract class TestJavaScriptChannelHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId, String channelName); - static void setup(TestJavaScriptChannelHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestJavaScriptChannelHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1196,24 +1366,30 @@ abstract class TestJavaScriptChannelHostApi { } abstract class TestWebViewClientHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - void setSynchronousReturnValueForShouldOverrideUrlLoading(int instanceId, bool value); + void setSynchronousReturnValueForShouldOverrideUrlLoading( + int instanceId, bool value); - static void setup(TestWebViewClientHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebViewClientHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewClientHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1225,14 +1401,18 @@ abstract class TestWebViewClientHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', codec, + 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1240,7 +1420,8 @@ abstract class TestWebViewClientHostApi { final bool? arg_value = (args[1] as bool?); assert(arg_value != null, 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null, expected non-null bool.'); - api.setSynchronousReturnValueForShouldOverrideUrlLoading(arg_instanceId!, arg_value!); + api.setSynchronousReturnValueForShouldOverrideUrlLoading( + arg_instanceId!, arg_value!); return []; }); } @@ -1249,22 +1430,27 @@ abstract class TestWebViewClientHostApi { } abstract class TestDownloadListenerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - static void setup(TestDownloadListenerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestDownloadListenerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.DownloadListenerHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.DownloadListenerHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.DownloadListenerHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1278,24 +1464,30 @@ abstract class TestDownloadListenerHostApi { } abstract class TestWebChromeClientHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - void setSynchronousReturnValueForOnShowFileChooser(int instanceId, bool value); + void setSynchronousReturnValueForOnShowFileChooser( + int instanceId, bool value); - static void setup(TestWebChromeClientHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebChromeClientHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebChromeClientHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1307,14 +1499,18 @@ abstract class TestWebChromeClientHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', codec, + 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1322,7 +1518,8 @@ abstract class TestWebChromeClientHostApi { final bool? arg_value = (args[1] as bool?); assert(arg_value != null, 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null, expected non-null bool.'); - api.setSynchronousReturnValueForOnShowFileChooser(arg_instanceId!, arg_value!); + api.setSynchronousReturnValueForOnShowFileChooser( + arg_instanceId!, arg_value!); return []; }); } @@ -1331,24 +1528,29 @@ abstract class TestWebChromeClientHostApi { } abstract class TestAssetManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); List list(String path); String getAssetFilePathByName(String name); - static void setup(TestAssetManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestAssetManagerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FlutterAssetManagerHostApi.list', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.list was null.'); + 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.list was null.'); final List args = (message as List?)!; final String? arg_path = (args[0] as String?); assert(arg_path != null, @@ -1360,14 +1562,18 @@ abstract class TestAssetManagerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', codec, + 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName was null.'); + 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName was null.'); final List args = (message as List?)!; final String? arg_name = (args[0] as String?); assert(arg_name != null, @@ -1381,24 +1587,29 @@ abstract class TestAssetManagerHostApi { } abstract class TestWebStorageHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); void deleteAllData(int instanceId); - static void setup(TestWebStorageHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebStorageHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebStorageHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebStorageHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebStorageHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1413,11 +1624,14 @@ abstract class TestWebStorageHostApi { 'dev.flutter.pigeon.WebStorageHostApi.deleteAllData', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebStorageHostApi.deleteAllData was null.'); + 'Argument for dev.flutter.pigeon.WebStorageHostApi.deleteAllData was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1438,7 +1652,8 @@ abstract class TestWebStorageHostApi { /// /// See https://developer.android.com/reference/android/webkit/PermissionRequest. abstract class TestPermissionRequestHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Handles Dart method `PermissionRequest.grant`. @@ -1447,22 +1662,27 @@ abstract class TestPermissionRequestHostApi { /// Handles Dart method `PermissionRequest.deny`. void deny(int instanceId); - static void setup(TestPermissionRequestHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestPermissionRequestHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PermissionRequestHostApi.grant', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null.'); + 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null, expected non-null int.'); - final List? arg_resources = (args[1] as List?)?.cast(); + final List? arg_resources = + (args[1] as List?)?.cast(); assert(arg_resources != null, 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null, expected non-null List.'); api.grant(arg_instanceId!, arg_resources!); @@ -1475,11 +1695,14 @@ abstract class TestPermissionRequestHostApi { 'dev.flutter.pigeon.PermissionRequestHostApi.deny', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.deny was null.'); + 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.deny was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1500,23 +1723,29 @@ abstract class TestPermissionRequestHostApi { /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. abstract class TestCustomViewCallbackHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Handles Dart method `CustomViewCallback.onCustomViewHidden`. void onCustomViewHidden(int identifier); - static void setup(TestCustomViewCallbackHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestCustomViewCallbackHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden', codec, + 'dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden was null.'); + 'Argument for dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, From 9f0dbe1fd0ae2430064aa3b2ddb3af6fa774e828 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 30 May 2023 12:11:48 -0400 Subject: [PATCH 10/35] dart side of webchromeclient wrap --- .../GeneratedAndroidWebView.java | 913 +++++++----------- .../lib/src/android_webview.dart | 39 + .../lib/src/android_webview.g.dart | 449 ++++----- .../lib/src/android_webview_api_impls.dart | 28 + .../pigeons/android_webview.dart | 10 + .../test/android_webview_test.dart | 82 ++ .../test/test_android_webview.g.dart | 687 +++++-------- 7 files changed, 931 insertions(+), 1277 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java index cfb5c0ccc19a..c09280287098 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java @@ -18,6 +18,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -34,7 +35,8 @@ public static class FlutterError extends RuntimeException { /** The error details. Must be a datatype supported by the api codec. */ public final Object details; - public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) { + public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) + { super(message); this.code = code; this.details = details; @@ -53,7 +55,7 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); } return errorList; } @@ -61,29 +63,26 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { /** * Mode of how to select files for a file chooser. * - *

See - * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. + * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. */ public enum FileChooserMode { /** - * Open single file and requires that the file exists before allowing the user to pick it. + * Open single file and requires that the file exists before allowing the + * user to pick it. * - *

See - * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN. + * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN. */ OPEN(0), /** * Similar to [open] but allows multiple files to be selected. * - *

See - * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE. + * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE. */ OPEN_MULTIPLE(1), /** * Allows picking a nonexistent file and saving it. * - *

See - * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE. + * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE. */ SAVE(2); @@ -375,10 +374,7 @@ ArrayList toList() { static @NonNull WebResourceErrorData fromList(@NonNull ArrayList list) { WebResourceErrorData pigeonResult = new WebResourceErrorData(); Object errorCode = list.get(0); - pigeonResult.setErrorCode( - (errorCode == null) - ? null - : ((errorCode instanceof Integer) ? (Integer) errorCode : (Long) errorCode)); + pigeonResult.setErrorCode((errorCode == null) ? null : ((errorCode instanceof Integer) ? (Integer) errorCode : (Long) errorCode)); Object description = list.get(1); pigeonResult.setDescription((String) description); return pigeonResult; @@ -467,13 +463,13 @@ public interface Result { /** * Host API for managing the native `InstanceManager`. * - *

Generated interface from Pigeon that represents a handler of messages from Flutter. + * Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface InstanceManagerHostApi { /** * Clear the native `InstanceManager`. * - *

This is typically only used after a hot restart. + * This is typically only used after a hot restart. */ void clear(); @@ -481,12 +477,8 @@ public interface InstanceManagerHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `InstanceManagerHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable InstanceManagerHostApi api) { + /**Sets up an instance of `InstanceManagerHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable InstanceManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -498,7 +490,8 @@ static void setup( try { api.clear(); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -513,11 +506,11 @@ static void setup( /** * Handles methods calls to the native Java Object class. * - *

Also handles calls to remove the reference to an instance with `dispose`. + * Also handles calls to remove the reference to an instance with `dispose`. * - *

See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. + * See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. * - *

Generated interface from Pigeon that represents a handler of messages from Flutter. + * Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface JavaObjectHostApi { @@ -527,9 +520,7 @@ public interface JavaObjectHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. - */ + /**Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObjectHostApi api) { { BasicMessageChannel channel = @@ -544,7 +535,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObject try { api.dispose((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -559,9 +551,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObject /** * Handles callbacks methods for the native Java Object class. * - *

See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. + * See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. * - *

Generated class from Pigeon that represents Flutter messages that can be called from Java. + * Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class JavaObjectFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -570,7 +562,7 @@ public JavaObjectFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -579,7 +571,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void dispose(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -592,11 +583,11 @@ public void dispose(@NonNull Long identifierArg, @NonNull Reply callback) /** * Host API for `CookieManager`. * - *

This class may handle instantiating and adding native object instances that are attached to - * a Dart instance or handle method calls on the associated native class or an instance of the - * class. + * This class may handle instantiating and adding native object instances that + * are attached to a Dart instance or handle method calls on the associated + * native class or an instance of the class. * - *

Generated interface from Pigeon that represents a handler of messages from Flutter. + * Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CookieManagerHostApi { /** Handles attaching `CookieManager.instance` to a native instance. */ @@ -606,25 +597,18 @@ public interface CookieManagerHostApi { /** Handles Dart method `CookieManager.removeAllCookies`. */ void removeAllCookies(@NonNull Long identifier, @NonNull Result result); /** Handles Dart method `CookieManager.setAcceptThirdPartyCookies`. */ - void setAcceptThirdPartyCookies( - @NonNull Long identifier, @NonNull Long webViewIdentifier, @NonNull Boolean accept); + void setAcceptThirdPartyCookies(@NonNull Long identifier, @NonNull Long webViewIdentifier, @NonNull Boolean accept); /** The codec used by CookieManagerHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `CookieManagerHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable CookieManagerHostApi api) { + /**Sets up an instance of `CookieManagerHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CookieManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.CookieManagerHostApi.attachInstance", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.CookieManagerHostApi.attachInstance", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -632,10 +616,10 @@ static void setup( ArrayList args = (ArrayList) message; Number instanceIdentifierArg = (Number) args.get(0); try { - api.attachInstance( - (instanceIdentifierArg == null) ? null : instanceIdentifierArg.longValue()); + api.attachInstance((instanceIdentifierArg == null) ? null : instanceIdentifierArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -658,10 +642,10 @@ static void setup( String urlArg = (String) args.get(1); String valueArg = (String) args.get(2); try { - api.setCookie( - (identifierArg == null) ? null : identifierArg.longValue(), urlArg, valueArg); + api.setCookie((identifierArg == null) ? null : identifierArg.longValue(), urlArg, valueArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -674,9 +658,7 @@ static void setup( { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -696,8 +678,7 @@ public void error(Throwable error) { } }; - api.removeAllCookies( - (identifierArg == null) ? null : identifierArg.longValue(), resultCallback); + api.removeAllCookies((identifierArg == null) ? null : identifierArg.longValue(), resultCallback); }); } else { channel.setMessageHandler(null); @@ -706,9 +687,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -718,12 +697,10 @@ public void error(Throwable error) { Number webViewIdentifierArg = (Number) args.get(1); Boolean acceptArg = (Boolean) args.get(2); try { - api.setAcceptThirdPartyCookies( - (identifierArg == null) ? null : identifierArg.longValue(), - (webViewIdentifierArg == null) ? null : webViewIdentifierArg.longValue(), - acceptArg); + api.setAcceptThirdPartyCookies((identifierArg == null) ? null : identifierArg.longValue(), (webViewIdentifierArg == null) ? null : webViewIdentifierArg.longValue(), acceptArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -767,32 +744,21 @@ public interface WebViewHostApi { void create(@NonNull Long instanceId); - void loadData( - @NonNull Long instanceId, - @NonNull String data, - @Nullable String mimeType, - @Nullable String encoding); + void loadData(@NonNull Long instanceId, @NonNull String data, @Nullable String mimeType, @Nullable String encoding); - void loadDataWithBaseUrl( - @NonNull Long instanceId, - @Nullable String baseUrl, - @NonNull String data, - @Nullable String mimeType, - @Nullable String encoding, - @Nullable String historyUrl); + void loadDataWithBaseUrl(@NonNull Long instanceId, @Nullable String baseUrl, @NonNull String data, @Nullable String mimeType, @Nullable String encoding, @Nullable String historyUrl); - void loadUrl( - @NonNull Long instanceId, @NonNull String url, @NonNull Map headers); + void loadUrl(@NonNull Long instanceId, @NonNull String url, @NonNull Map headers); void postUrl(@NonNull Long instanceId, @NonNull String url, @NonNull byte[] data); - @Nullable + @Nullable String getUrl(@NonNull Long instanceId); - @NonNull + @NonNull Boolean canGoBack(@NonNull Long instanceId); - @NonNull + @NonNull Boolean canGoForward(@NonNull Long instanceId); void goBack(@NonNull Long instanceId); @@ -803,23 +769,22 @@ void loadUrl( void clearCache(@NonNull Long instanceId, @NonNull Boolean includeDiskFiles); - void evaluateJavascript( - @NonNull Long instanceId, @NonNull String javascriptString, @NonNull Result result); + void evaluateJavascript(@NonNull Long instanceId, @NonNull String javascriptString, @NonNull Result result); - @Nullable + @Nullable String getTitle(@NonNull Long instanceId); void scrollTo(@NonNull Long instanceId, @NonNull Long x, @NonNull Long y); void scrollBy(@NonNull Long instanceId, @NonNull Long x, @NonNull Long y); - @NonNull + @NonNull Long getScrollX(@NonNull Long instanceId); - @NonNull + @NonNull Long getScrollY(@NonNull Long instanceId); - @NonNull + @NonNull WebViewPoint getScrollPosition(@NonNull Long instanceId); void setWebContentsDebuggingEnabled(@NonNull Boolean enabled); @@ -828,8 +793,7 @@ void evaluateJavascript( void addJavaScriptChannel(@NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId); - void removeJavaScriptChannel( - @NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId); + void removeJavaScriptChannel(@NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId); void setDownloadListener(@NonNull Long instanceId, @Nullable Long listenerInstanceId); @@ -841,7 +805,7 @@ void removeJavaScriptChannel( static @NonNull MessageCodec getCodec() { return WebViewHostApiCodec.INSTANCE; } - /** Sets up an instance of `WebViewHostApi` to handle messages through the `binaryMessenger`. */ + /**Sets up an instance of `WebViewHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHostApi api) { { BasicMessageChannel channel = @@ -856,7 +820,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -880,13 +845,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos String mimeTypeArg = (String) args.get(2); String encodingArg = (String) args.get(3); try { - api.loadData( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - dataArg, - mimeTypeArg, - encodingArg); + api.loadData((instanceIdArg == null) ? null : instanceIdArg.longValue(), dataArg, mimeTypeArg, encodingArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -899,9 +861,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -914,15 +874,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos String encodingArg = (String) args.get(4); String historyUrlArg = (String) args.get(5); try { - api.loadDataWithBaseUrl( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - baseUrlArg, - dataArg, - mimeTypeArg, - encodingArg, - historyUrlArg); + api.loadDataWithBaseUrl((instanceIdArg == null) ? null : instanceIdArg.longValue(), baseUrlArg, dataArg, mimeTypeArg, encodingArg, historyUrlArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -945,12 +900,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos String urlArg = (String) args.get(1); Map headersArg = (Map) args.get(2); try { - api.loadUrl( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - urlArg, - headersArg); + api.loadUrl((instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, headersArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -973,10 +926,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos String urlArg = (String) args.get(1); byte[] dataArg = (byte[]) args.get(2); try { - api.postUrl( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, dataArg); + api.postUrl((instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, dataArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -997,10 +950,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - String output = - api.getUrl((instanceIdArg == null) ? null : instanceIdArg.longValue()); + String output = api.getUrl((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1021,10 +974,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - Boolean output = - api.canGoBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); + Boolean output = api.canGoBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1045,10 +998,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - Boolean output = - api.canGoForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); + Boolean output = api.canGoForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1071,7 +1024,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos try { api.goBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1094,7 +1048,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos try { api.goForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1117,7 +1072,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos try { api.reload((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1139,11 +1095,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos Number instanceIdArg = (Number) args.get(0); Boolean includeDiskFilesArg = (Boolean) args.get(1); try { - api.clearCache( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - includeDiskFilesArg); + api.clearCache((instanceIdArg == null) ? null : instanceIdArg.longValue(), includeDiskFilesArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1156,9 +1111,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.evaluateJavascript", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.evaluateJavascript", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1179,10 +1132,7 @@ public void error(Throwable error) { } }; - api.evaluateJavascript( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - javascriptStringArg, - resultCallback); + api.evaluateJavascript((instanceIdArg == null) ? null : instanceIdArg.longValue(), javascriptStringArg, resultCallback); }); } else { channel.setMessageHandler(null); @@ -1199,10 +1149,10 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - String output = - api.getTitle((instanceIdArg == null) ? null : instanceIdArg.longValue()); + String output = api.getTitle((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1225,12 +1175,10 @@ public void error(Throwable error) { Number xArg = (Number) args.get(1); Number yArg = (Number) args.get(2); try { - api.scrollTo( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (xArg == null) ? null : xArg.longValue(), - (yArg == null) ? null : yArg.longValue()); + api.scrollTo((instanceIdArg == null) ? null : instanceIdArg.longValue(), (xArg == null) ? null : xArg.longValue(), (yArg == null) ? null : yArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1253,12 +1201,10 @@ public void error(Throwable error) { Number xArg = (Number) args.get(1); Number yArg = (Number) args.get(2); try { - api.scrollBy( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (xArg == null) ? null : xArg.longValue(), - (yArg == null) ? null : yArg.longValue()); + api.scrollBy((instanceIdArg == null) ? null : instanceIdArg.longValue(), (xArg == null) ? null : xArg.longValue(), (yArg == null) ? null : yArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1279,10 +1225,10 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - Long output = - api.getScrollX((instanceIdArg == null) ? null : instanceIdArg.longValue()); + Long output = api.getScrollX((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1303,10 +1249,10 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - Long output = - api.getScrollY((instanceIdArg == null) ? null : instanceIdArg.longValue()); + Long output = api.getScrollY((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1327,11 +1273,10 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - WebViewPoint output = - api.getScrollPosition( - (instanceIdArg == null) ? null : instanceIdArg.longValue()); + WebViewPoint output = api.getScrollPosition((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1344,9 +1289,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1356,7 +1299,8 @@ public void error(Throwable error) { try { api.setWebContentsDebuggingEnabled(enabledArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1378,13 +1322,10 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number webViewClientInstanceIdArg = (Number) args.get(1); try { - api.setWebViewClient( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (webViewClientInstanceIdArg == null) - ? null - : webViewClientInstanceIdArg.longValue()); + api.setWebViewClient((instanceIdArg == null) ? null : instanceIdArg.longValue(), (webViewClientInstanceIdArg == null) ? null : webViewClientInstanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1397,9 +1338,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1408,13 +1347,10 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number javaScriptChannelInstanceIdArg = (Number) args.get(1); try { - api.addJavaScriptChannel( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (javaScriptChannelInstanceIdArg == null) - ? null - : javaScriptChannelInstanceIdArg.longValue()); + api.addJavaScriptChannel((instanceIdArg == null) ? null : instanceIdArg.longValue(), (javaScriptChannelInstanceIdArg == null) ? null : javaScriptChannelInstanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1427,9 +1363,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1438,13 +1372,10 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number javaScriptChannelInstanceIdArg = (Number) args.get(1); try { - api.removeJavaScriptChannel( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (javaScriptChannelInstanceIdArg == null) - ? null - : javaScriptChannelInstanceIdArg.longValue()); + api.removeJavaScriptChannel((instanceIdArg == null) ? null : instanceIdArg.longValue(), (javaScriptChannelInstanceIdArg == null) ? null : javaScriptChannelInstanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1457,9 +1388,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.setDownloadListener", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setDownloadListener", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1468,11 +1397,10 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number listenerInstanceIdArg = (Number) args.get(1); try { - api.setDownloadListener( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (listenerInstanceIdArg == null) ? null : listenerInstanceIdArg.longValue()); + api.setDownloadListener((instanceIdArg == null) ? null : instanceIdArg.longValue(), (listenerInstanceIdArg == null) ? null : listenerInstanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1485,9 +1413,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.setWebChromeClient", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setWebChromeClient", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1496,11 +1422,10 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number clientInstanceIdArg = (Number) args.get(1); try { - api.setWebChromeClient( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (clientInstanceIdArg == null) ? null : clientInstanceIdArg.longValue()); + api.setWebChromeClient((instanceIdArg == null) ? null : instanceIdArg.longValue(), (clientInstanceIdArg == null) ? null : clientInstanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1513,9 +1438,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.setBackgroundColor", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setBackgroundColor", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1524,11 +1447,10 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number colorArg = (Number) args.get(1); try { - api.setBackgroundColor( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (colorArg == null) ? null : colorArg.longValue()); + api.setBackgroundColor((instanceIdArg == null) ? null : instanceIdArg.longValue(), (colorArg == null) ? null : colorArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1543,12 +1465,13 @@ public void error(Throwable error) { /** * Flutter API for `WebView`. * - *

This class may handle instantiating and adding Dart instances that are attached to a native - * instance or receiving callback methods from an overridden native class. + * This class may handle instantiating and adding Dart instances that are + * attached to a native instance or receiving callback methods from an + * overridden native class. * - *

See https://developer.android.com/reference/android/webkit/WebView. + * See https://developer.android.com/reference/android/webkit/WebView. * - *

Generated class from Pigeon that represents Flutter messages that can be called from Java. + * Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class WebViewFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -1557,7 +1480,7 @@ public WebViewFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1611,9 +1534,7 @@ public interface WebSettingsHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `WebSettingsHostApi` to handle messages through the `binaryMessenger`. - */ + /**Sets up an instance of `WebSettingsHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSettingsHostApi api) { { BasicMessageChannel channel = @@ -1627,11 +1548,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Number webViewInstanceIdArg = (Number) args.get(1); try { - api.create( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (webViewInstanceIdArg == null) ? null : webViewInstanceIdArg.longValue()); + api.create((instanceIdArg == null) ? null : instanceIdArg.longValue(), (webViewInstanceIdArg == null) ? null : webViewInstanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1644,9 +1564,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1655,10 +1573,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean flagArg = (Boolean) args.get(1); try { - api.setDomStorageEnabled( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); + api.setDomStorageEnabled((instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1671,9 +1589,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1682,10 +1598,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean flagArg = (Boolean) args.get(1); try { - api.setJavaScriptCanOpenWindowsAutomatically( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); + api.setJavaScriptCanOpenWindowsAutomatically((instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1698,9 +1614,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1709,10 +1623,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean supportArg = (Boolean) args.get(1); try { - api.setSupportMultipleWindows( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); + api.setSupportMultipleWindows((instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1725,9 +1639,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1736,10 +1648,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean flagArg = (Boolean) args.get(1); try { - api.setJavaScriptEnabled( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); + api.setJavaScriptEnabled((instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1752,9 +1664,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1763,11 +1673,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); String userAgentStringArg = (String) args.get(1); try { - api.setUserAgentString( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - userAgentStringArg); + api.setUserAgentString((instanceIdArg == null) ? null : instanceIdArg.longValue(), userAgentStringArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1780,9 +1689,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1791,10 +1698,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean requireArg = (Boolean) args.get(1); try { - api.setMediaPlaybackRequiresUserGesture( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), requireArg); + api.setMediaPlaybackRequiresUserGesture((instanceIdArg == null) ? null : instanceIdArg.longValue(), requireArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1807,9 +1714,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1818,10 +1723,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean supportArg = (Boolean) args.get(1); try { - api.setSupportZoom( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); + api.setSupportZoom((instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1834,9 +1739,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1845,10 +1748,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean overviewArg = (Boolean) args.get(1); try { - api.setLoadWithOverviewMode( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), overviewArg); + api.setLoadWithOverviewMode((instanceIdArg == null) ? null : instanceIdArg.longValue(), overviewArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1861,9 +1764,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1872,10 +1773,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean useArg = (Boolean) args.get(1); try { - api.setUseWideViewPort( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), useArg); + api.setUseWideViewPort((instanceIdArg == null) ? null : instanceIdArg.longValue(), useArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1888,9 +1789,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1899,10 +1798,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean enabledArg = (Boolean) args.get(1); try { - api.setDisplayZoomControls( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); + api.setDisplayZoomControls((instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1915,9 +1814,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1926,10 +1823,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean enabledArg = (Boolean) args.get(1); try { - api.setBuiltInZoomControls( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); + api.setBuiltInZoomControls((instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1942,9 +1839,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1953,10 +1848,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean enabledArg = (Boolean) args.get(1); try { - api.setAllowFileAccess( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); + api.setAllowFileAccess((instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1978,11 +1873,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Number textZoomArg = (Number) args.get(1); try { - api.setTextZoom( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (textZoomArg == null) ? null : textZoomArg.longValue()); + api.setTextZoom((instanceIdArg == null) ? null : instanceIdArg.longValue(), (textZoomArg == null) ? null : textZoomArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2003,12 +1897,8 @@ public interface JavaScriptChannelHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `JavaScriptChannelHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable JavaScriptChannelHostApi api) { + /**Sets up an instance of `JavaScriptChannelHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaScriptChannelHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2021,10 +1911,10 @@ static void setup( Number instanceIdArg = (Number) args.get(0); String channelNameArg = (String) args.get(1); try { - api.create( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), channelNameArg); + api.create((instanceIdArg == null) ? null : instanceIdArg.longValue(), channelNameArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2044,7 +1934,7 @@ public JavaScriptChannelFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2053,14 +1943,10 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - - public void postMessage( - @NonNull Long instanceIdArg, @NonNull String messageArg, @NonNull Reply callback) { + public void postMessage(@NonNull Long instanceIdArg, @NonNull String messageArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage", getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, messageArg)), channelReply -> callback.reply(null)); @@ -2071,19 +1957,14 @@ public interface WebViewClientHostApi { void create(@NonNull Long instanceId); - void setSynchronousReturnValueForShouldOverrideUrlLoading( - @NonNull Long instanceId, @NonNull Boolean value); + void setSynchronousReturnValueForShouldOverrideUrlLoading(@NonNull Long instanceId, @NonNull Boolean value); /** The codec used by WebViewClientHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `WebViewClientHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable WebViewClientHostApi api) { + /**Sets up an instance of `WebViewClientHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewClientHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2097,7 +1978,8 @@ static void setup( try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2110,9 +1992,7 @@ static void setup( { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2121,10 +2001,10 @@ static void setup( Number instanceIdArg = (Number) args.get(0); Boolean valueArg = (Boolean) args.get(1); try { - api.setSynchronousReturnValueForShouldOverrideUrlLoading( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); + api.setSynchronousReturnValueForShouldOverrideUrlLoading((instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2176,7 +2056,7 @@ public WebViewClientFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2185,97 +2065,47 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return WebViewClientFlutterApiCodec.INSTANCE; } - - public void onPageStarted( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull String urlArg, - @NonNull Reply callback) { + public void onPageStarted(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted", getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), channelReply -> callback.reply(null)); } - - public void onPageFinished( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull String urlArg, - @NonNull Reply callback) { + public void onPageFinished(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished", getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), channelReply -> callback.reply(null)); } - - public void onReceivedRequestError( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull WebResourceRequestData requestArg, - @NonNull WebResourceErrorData errorArg, - @NonNull Reply callback) { + public void onReceivedRequestError(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull WebResourceRequestData requestArg, @NonNull WebResourceErrorData errorArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError", getCodec()); channel.send( - new ArrayList( - Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg, errorArg)), + new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg, errorArg)), channelReply -> callback.reply(null)); } - - public void onReceivedError( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull Long errorCodeArg, - @NonNull String descriptionArg, - @NonNull String failingUrlArg, - @NonNull Reply callback) { + public void onReceivedError(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull Long errorCodeArg, @NonNull String descriptionArg, @NonNull String failingUrlArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError", getCodec()); channel.send( - new ArrayList( - Arrays.asList( - instanceIdArg, - webViewInstanceIdArg, - errorCodeArg, - descriptionArg, - failingUrlArg)), + new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, errorCodeArg, descriptionArg, failingUrlArg)), channelReply -> callback.reply(null)); } - - public void requestLoading( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull WebResourceRequestData requestArg, - @NonNull Reply callback) { + public void requestLoading(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull WebResourceRequestData requestArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading", getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg)), channelReply -> callback.reply(null)); } - - public void urlLoading( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull String urlArg, - @NonNull Reply callback) { + public void urlLoading(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading", getCodec()); @@ -2283,21 +2113,12 @@ public void urlLoading( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), channelReply -> callback.reply(null)); } - - public void doUpdateVisitedHistory( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull String urlArg, - @NonNull Boolean isReloadArg, - @NonNull Reply callback) { + public void doUpdateVisitedHistory(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Boolean isReloadArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory", getCodec()); channel.send( - new ArrayList( - Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg, isReloadArg)), + new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg, isReloadArg)), channelReply -> callback.reply(null)); } } @@ -2310,12 +2131,8 @@ public interface DownloadListenerHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `DownloadListenerHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable DownloadListenerHostApi api) { + /**Sets up an instance of `DownloadListenerHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DownloadListenerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2329,7 +2146,8 @@ static void setup( try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2349,7 +2167,7 @@ public DownloadListenerFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2358,29 +2176,12 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - - public void onDownloadStart( - @NonNull Long instanceIdArg, - @NonNull String urlArg, - @NonNull String userAgentArg, - @NonNull String contentDispositionArg, - @NonNull String mimetypeArg, - @NonNull Long contentLengthArg, - @NonNull Reply callback) { + public void onDownloadStart(@NonNull Long instanceIdArg, @NonNull String urlArg, @NonNull String userAgentArg, @NonNull String contentDispositionArg, @NonNull String mimetypeArg, @NonNull Long contentLengthArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart", getCodec()); channel.send( - new ArrayList( - Arrays.asList( - instanceIdArg, - urlArg, - userAgentArg, - contentDispositionArg, - mimetypeArg, - contentLengthArg)), + new ArrayList(Arrays.asList(instanceIdArg, urlArg, userAgentArg, contentDispositionArg, mimetypeArg, contentLengthArg)), channelReply -> callback.reply(null)); } } @@ -2389,19 +2190,14 @@ public interface WebChromeClientHostApi { void create(@NonNull Long instanceId); - void setSynchronousReturnValueForOnShowFileChooser( - @NonNull Long instanceId, @NonNull Boolean value); + void setSynchronousReturnValueForOnShowFileChooser(@NonNull Long instanceId, @NonNull Boolean value); /** The codec used by WebChromeClientHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `WebChromeClientHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeClientHostApi api) { + /**Sets up an instance of `WebChromeClientHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeClientHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2415,7 +2211,8 @@ static void setup( try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2428,9 +2225,7 @@ static void setup( { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2439,10 +2234,10 @@ static void setup( Number instanceIdArg = (Number) args.get(0); Boolean valueArg = (Boolean) args.get(1); try { - api.setSynchronousReturnValueForOnShowFileChooser( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); + api.setSynchronousReturnValueForOnShowFileChooser((instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2457,22 +2252,18 @@ static void setup( /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface FlutterAssetManagerHostApi { - @NonNull + @NonNull List list(@NonNull String path); - @NonNull + @NonNull String getAssetFilePathByName(@NonNull String name); /** The codec used by FlutterAssetManagerHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `FlutterAssetManagerHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable FlutterAssetManagerHostApi api) { + /**Sets up an instance of `FlutterAssetManagerHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable FlutterAssetManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2486,7 +2277,8 @@ static void setup( try { List output = api.list(pathArg); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2499,9 +2291,7 @@ static void setup( { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2511,7 +2301,8 @@ static void setup( try { String output = api.getAssetFilePathByName(nameArg); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2531,7 +2322,7 @@ public WebChromeClientFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2540,35 +2331,20 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - - public void onProgressChanged( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull Long progressArg, - @NonNull Reply callback) { + public void onProgressChanged(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull Long progressArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged", getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, progressArg)), channelReply -> callback.reply(null)); } - - public void onShowFileChooser( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull Long paramsInstanceIdArg, - @NonNull Reply> callback) { + public void onShowFileChooser(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull Long paramsInstanceIdArg, @NonNull Reply> callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser", getCodec()); channel.send( - new ArrayList( - Arrays.asList(instanceIdArg, webViewInstanceIdArg, paramsInstanceIdArg)), + new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, paramsInstanceIdArg)), channelReply -> { @SuppressWarnings("ConstantConditions") List output = (List) channelReply; @@ -2576,19 +2352,32 @@ public void onShowFileChooser( }); } /** Callback to Dart function `WebChromeClient.onPermissionRequest`. */ - public void onPermissionRequest( - @NonNull Long instanceIdArg, - @NonNull Long requestInstanceIdArg, - @NonNull Reply callback) { + public void onPermissionRequest(@NonNull Long instanceIdArg, @NonNull Long requestInstanceIdArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest", getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, requestInstanceIdArg)), channelReply -> callback.reply(null)); } + /** Callback to Dart function `WebChromeClient.onShowCustomView`. */ + public void onShowCustomView(@NonNull Long instanceIdArg, @NonNull Long viewIdentifierArg, @NonNull Long callbackIdentifierArg, @NonNull Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView", getCodec()); + channel.send( + new ArrayList(Arrays.asList(instanceIdArg, viewIdentifierArg, callbackIdentifierArg)), + channelReply -> callback.reply(null)); + } + /** Callback to Dart function `WebChromeClient.onHideCustomView`. */ + public void onHideCustomView(@NonNull Long instanceIdArg, @NonNull Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onHideCustomView", getCodec()); + channel.send( + new ArrayList(Collections.singletonList(instanceIdArg)), + channelReply -> callback.reply(null)); + } } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface WebStorageHostApi { @@ -2601,9 +2390,7 @@ public interface WebStorageHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `WebStorageHostApi` to handle messages through the `binaryMessenger`. - */ + /**Sets up an instance of `WebStorageHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorageHostApi api) { { BasicMessageChannel channel = @@ -2618,7 +2405,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorage try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2641,7 +2429,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorage try { api.deleteAllData((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2655,8 +2444,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorage } private static class FileChooserParamsFlutterApiCodec extends StandardMessageCodec { - public static final FileChooserParamsFlutterApiCodec INSTANCE = - new FileChooserParamsFlutterApiCodec(); + public static final FileChooserParamsFlutterApiCodec INSTANCE = new FileChooserParamsFlutterApiCodec(); private FileChooserParamsFlutterApiCodec() {} @@ -2684,10 +2472,9 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { /** * Handles callbacks methods for the native Java FileChooserParams class. * - *

See - * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. + * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. * - *

Generated class from Pigeon that represents Flutter messages that can be called from Java. + * Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class FileChooserParamsFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2696,7 +2483,7 @@ public FileChooserParamsFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2705,34 +2492,25 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return FileChooserParamsFlutterApiCodec.INSTANCE; } - - public void create( - @NonNull Long instanceIdArg, - @NonNull Boolean isCaptureEnabledArg, - @NonNull List acceptTypesArg, - @NonNull FileChooserModeEnumData modeArg, - @Nullable String filenameHintArg, - @NonNull Reply callback) { + public void create(@NonNull Long instanceIdArg, @NonNull Boolean isCaptureEnabledArg, @NonNull List acceptTypesArg, @NonNull FileChooserModeEnumData modeArg, @Nullable String filenameHintArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.FileChooserParamsFlutterApi.create", getCodec()); channel.send( - new ArrayList( - Arrays.asList( - instanceIdArg, isCaptureEnabledArg, acceptTypesArg, modeArg, filenameHintArg)), + new ArrayList(Arrays.asList(instanceIdArg, isCaptureEnabledArg, acceptTypesArg, modeArg, filenameHintArg)), channelReply -> callback.reply(null)); } } /** * Host API for `PermissionRequest`. * - *

This class may handle instantiating and adding native object instances that are attached to - * a Dart instance or handle method calls on the associated native class or an instance of the - * class. + * This class may handle instantiating and adding native object instances that + * are attached to a Dart instance or handle method calls on the associated + * native class or an instance of the class. * - *

See https://developer.android.com/reference/android/webkit/PermissionRequest. + * See https://developer.android.com/reference/android/webkit/PermissionRequest. * - *

Generated interface from Pigeon that represents a handler of messages from Flutter. + * Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface PermissionRequestHostApi { /** Handles Dart method `PermissionRequest.grant`. */ @@ -2744,12 +2522,8 @@ public interface PermissionRequestHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `PermissionRequestHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable PermissionRequestHostApi api) { + /**Sets up an instance of `PermissionRequestHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PermissionRequestHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2762,10 +2536,10 @@ static void setup( Number instanceIdArg = (Number) args.get(0); List resourcesArg = (List) args.get(1); try { - api.grant( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), resourcesArg); + api.grant((instanceIdArg == null) ? null : instanceIdArg.longValue(), resourcesArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2788,7 +2562,8 @@ static void setup( try { api.deny((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2803,12 +2578,13 @@ static void setup( /** * Flutter API for `PermissionRequest`. * - *

This class may handle instantiating and adding Dart instances that are attached to a native - * instance or receiving callback methods from an overridden native class. + * This class may handle instantiating and adding Dart instances that are + * attached to a native instance or receiving callback methods from an + * overridden native class. * - *

See https://developer.android.com/reference/android/webkit/PermissionRequest. + * See https://developer.android.com/reference/android/webkit/PermissionRequest. * - *

Generated class from Pigeon that represents Flutter messages that can be called from Java. + * Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class PermissionRequestFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2817,7 +2593,7 @@ public PermissionRequestFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2827,10 +2603,7 @@ public interface Reply { return new StandardMessageCodec(); } /** Create a new Dart instance and add it to the `InstanceManager`. */ - public void create( - @NonNull Long instanceIdArg, - @NonNull List resourcesArg, - @NonNull Reply callback) { + public void create(@NonNull Long instanceIdArg, @NonNull List resourcesArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.PermissionRequestFlutterApi.create", getCodec()); @@ -2842,14 +2615,13 @@ public void create( /** * Host API for `CustomViewCallback`. * - *

This class may handle instantiating and adding native object instances that are attached to - * a Dart instance or handle method calls on the associated native class or an instance of the - * class. + * This class may handle instantiating and adding native object instances that + * are attached to a Dart instance or handle method calls on the associated + * native class or an instance of the class. * - *

See - * https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. + * See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. * - *

Generated interface from Pigeon that represents a handler of messages from Flutter. + * Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CustomViewCallbackHostApi { /** Handles Dart method `CustomViewCallback.onCustomViewHidden`. */ @@ -2859,18 +2631,12 @@ public interface CustomViewCallbackHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `CustomViewCallbackHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable CustomViewCallbackHostApi api) { + /**Sets up an instance of `CustomViewCallbackHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CustomViewCallbackHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2878,10 +2644,10 @@ static void setup( ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - api.onCustomViewHidden( - (identifierArg == null) ? null : identifierArg.longValue()); + api.onCustomViewHidden((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2896,13 +2662,13 @@ static void setup( /** * Flutter API for `CustomViewCallback`. * - *

This class may handle instantiating and adding Dart instances that are attached to a native - * instance or receiving callback methods from an overridden native class. + * This class may handle instantiating and adding Dart instances that are + * attached to a native instance or receiving callback methods from an + * overridden native class. * - *

See - * https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. + * See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. * - *

Generated class from Pigeon that represents Flutter messages that can be called from Java. + * Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class CustomViewCallbackFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2911,7 +2677,7 @@ public CustomViewCallbackFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2924,9 +2690,7 @@ public interface Reply { public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.CustomViewCallbackFlutterApi.create", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.CustomViewCallbackFlutterApi.create", getCodec()); channel.send( new ArrayList(Collections.singletonList(identifierArg)), channelReply -> callback.reply(null)); @@ -2935,12 +2699,13 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { /** * Flutter API for `View`. * - *

This class may handle instantiating and adding Dart instances that are attached to a native - * instance or receiving callback methods from an overridden native class. + * This class may handle instantiating and adding Dart instances that are + * attached to a native instance or receiving callback methods from an + * overridden native class. * - *

See https://developer.android.com/reference/android/view/View. + * See https://developer.android.com/reference/android/view/View. * - *

Generated class from Pigeon that represents Flutter messages that can be called from Java. + * Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class ViewFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2949,7 +2714,7 @@ public ViewFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart index a4b7d5413328..ff5b4573cb01 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart @@ -969,12 +969,15 @@ class DownloadListener extends JavaObject { } /// Handles JavaScript dialogs, favicons, titles, and the progress for [WebView]. +@SimpleClassAnnotation() class WebChromeClient extends JavaObject { /// Constructs a [WebChromeClient]. WebChromeClient({ this.onProgressChanged, this.onShowFileChooser, this.onPermissionRequest, + this.onShowCustomView, + this.onHideCustomView, @visibleForTesting super.binaryMessenger, @visibleForTesting super.instanceManager, }) : super.detached() { @@ -992,6 +995,8 @@ class WebChromeClient extends JavaObject { this.onProgressChanged, this.onShowFileChooser, this.onPermissionRequest, + this.onShowCustomView, + this.onHideCustomView, super.binaryMessenger, super.instanceManager, }) : super.detached(); @@ -1026,6 +1031,21 @@ class WebChromeClient extends JavaObject { PermissionRequest request, )? onPermissionRequest; + /// Notify the host application that the current page has entered full screen + /// mode. + /// + /// After this call, web content will no longer be rendered in the WebView, + /// but will instead be rendered in `view`. + final void Function( + WebChromeClient instance, + View view, + CustomViewCallback callback, + )? onShowCustomView; + + /// Notify the host application that the current page has exited full screen + /// mode. + final void Function(WebChromeClient instance)? onHideCustomView; + /// Sets the required synchronous return value for the Java method, /// `WebChromeClient.onShowFileChooser(...)`. /// @@ -1060,6 +1080,9 @@ class WebChromeClient extends JavaObject { return WebChromeClient.detached( onProgressChanged: onProgressChanged, onShowFileChooser: onShowFileChooser, + onPermissionRequest: onPermissionRequest, + onShowCustomView: onShowCustomView, + onHideCustomView: onHideCustomView, binaryMessenger: _api.binaryMessenger, instanceManager: _api.instanceManager, ); @@ -1311,6 +1334,14 @@ class View extends JavaObject { @protected View.detached({super.binaryMessenger, super.instanceManager}) : super.detached(); + + @override + View copy() { + return View.detached( + binaryMessenger: _api.binaryMessenger, + instanceManager: _api.instanceManager, + ); + } } /// A callback interface used by the host application to notify the current page @@ -1339,4 +1370,12 @@ class CustomViewCallback extends JavaObject { Future onCustomViewHidden() { return _customViewCallbackApi.onCustomViewHiddenFromInstances(this); } + + @override + CustomViewCallback copy() { + return CustomViewCallback.detached( + binaryMessenger: _customViewCallbackApi.binaryMessenger, + instanceManager: _customViewCallbackApi.instanceManager, + ); + } } diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart index ddd4d5274943..5faf679d3f33 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart @@ -20,12 +20,10 @@ enum FileChooserMode { /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN. open, - /// Similar to [open] but allows multiple files to be selected. /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE. openMultiple, - /// Allows picking a nonexistent file and saving it. /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE. @@ -94,8 +92,7 @@ class WebResourceRequestData { isRedirect: result[2] as bool?, hasGesture: result[3]! as bool, method: result[4]! as String, - requestHeaders: - (result[5] as Map?)!.cast(), + requestHeaders: (result[5] as Map?)!.cast(), ); } } @@ -170,7 +167,8 @@ class InstanceManagerHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.InstanceManagerHostApi.clear', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; + final List? replyList = + await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -234,8 +232,7 @@ abstract class JavaObjectFlutterApi { void dispose(int identifier); - static void setup(JavaObjectFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(JavaObjectFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaObjectFlutterApi.dispose', codec, @@ -245,7 +242,7 @@ abstract class JavaObjectFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -297,13 +294,12 @@ class CookieManagerHostApi { } /// Handles Dart method `CookieManager.setCookie`. - Future setCookie( - int arg_identifier, String arg_url, String arg_value) async { + Future setCookie(int arg_identifier, String arg_url, String arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CookieManagerHostApi.setCookie', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_url, arg_value]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_url, arg_value]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -349,15 +345,12 @@ class CookieManagerHostApi { } /// Handles Dart method `CookieManager.setAcceptThirdPartyCookies`. - Future setAcceptThirdPartyCookies( - int arg_identifier, int arg_webViewIdentifier, bool arg_accept) async { + Future setAcceptThirdPartyCookies(int arg_identifier, int arg_webViewIdentifier, bool arg_accept) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies', - codec, + 'dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_webViewIdentifier, arg_accept]) - as List?; + final List? replyList = + await channel.send([arg_identifier, arg_webViewIdentifier, arg_accept]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -390,7 +383,7 @@ class _WebViewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebViewPoint.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -430,14 +423,12 @@ class WebViewHostApi { } } - Future loadData(int arg_instanceId, String arg_data, - String? arg_mimeType, String? arg_encoding) async { + Future loadData(int arg_instanceId, String arg_data, String? arg_mimeType, String? arg_encoding) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.loadData', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send( - [arg_instanceId, arg_data, arg_mimeType, arg_encoding]) - as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_data, arg_mimeType, arg_encoding]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -454,24 +445,12 @@ class WebViewHostApi { } } - Future loadDataWithBaseUrl( - int arg_instanceId, - String? arg_baseUrl, - String arg_data, - String? arg_mimeType, - String? arg_encoding, - String? arg_historyUrl) async { + Future loadDataWithBaseUrl(int arg_instanceId, String? arg_baseUrl, String arg_data, String? arg_mimeType, String? arg_encoding, String? arg_historyUrl) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send([ - arg_instanceId, - arg_baseUrl, - arg_data, - arg_mimeType, - arg_encoding, - arg_historyUrl - ]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_baseUrl, arg_data, arg_mimeType, arg_encoding, arg_historyUrl]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -488,14 +467,12 @@ class WebViewHostApi { } } - Future loadUrl(int arg_instanceId, String arg_url, - Map arg_headers) async { + Future loadUrl(int arg_instanceId, String arg_url, Map arg_headers) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.loadUrl', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_url, arg_headers]) - as List?; + await channel.send([arg_instanceId, arg_url, arg_headers]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -512,13 +489,12 @@ class WebViewHostApi { } } - Future postUrl( - int arg_instanceId, String arg_url, Uint8List arg_data) async { + Future postUrl(int arg_instanceId, String arg_url, Uint8List arg_data) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.postUrl', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_url, arg_data]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_url, arg_data]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -682,8 +658,7 @@ class WebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.clearCache', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_includeDiskFiles]) - as List?; + await channel.send([arg_instanceId, arg_includeDiskFiles]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -700,14 +675,12 @@ class WebViewHostApi { } } - Future evaluateJavascript( - int arg_instanceId, String arg_javascriptString) async { + Future evaluateJavascript(int arg_instanceId, String arg_javascriptString) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.evaluateJavascript', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_javascriptString]) - as List?; + await channel.send([arg_instanceId, arg_javascriptString]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -750,8 +723,8 @@ class WebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.scrollTo', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_x, arg_y]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_x, arg_y]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -772,8 +745,8 @@ class WebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.scrollBy', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_x, arg_y]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_x, arg_y]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -873,8 +846,7 @@ class WebViewHostApi { Future setWebContentsDebuggingEnabled(bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', - codec, + 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_enabled]) as List?; @@ -894,14 +866,12 @@ class WebViewHostApi { } } - Future setWebViewClient( - int arg_instanceId, int arg_webViewClientInstanceId) async { + Future setWebViewClient(int arg_instanceId, int arg_webViewClientInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setWebViewClient', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_webViewClientInstanceId]) - as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_webViewClientInstanceId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -918,14 +888,12 @@ class WebViewHostApi { } } - Future addJavaScriptChannel( - int arg_instanceId, int arg_javaScriptChannelInstanceId) async { + Future addJavaScriptChannel(int arg_instanceId, int arg_javaScriptChannelInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_javaScriptChannelInstanceId]) - as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_javaScriptChannelInstanceId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -942,14 +910,12 @@ class WebViewHostApi { } } - Future removeJavaScriptChannel( - int arg_instanceId, int arg_javaScriptChannelInstanceId) async { + Future removeJavaScriptChannel(int arg_instanceId, int arg_javaScriptChannelInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_javaScriptChannelInstanceId]) - as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_javaScriptChannelInstanceId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -966,14 +932,12 @@ class WebViewHostApi { } } - Future setDownloadListener( - int arg_instanceId, int? arg_listenerInstanceId) async { + Future setDownloadListener(int arg_instanceId, int? arg_listenerInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setDownloadListener', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_listenerInstanceId]) - as List?; + await channel.send([arg_instanceId, arg_listenerInstanceId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -990,14 +954,12 @@ class WebViewHostApi { } } - Future setWebChromeClient( - int arg_instanceId, int? arg_clientInstanceId) async { + Future setWebChromeClient(int arg_instanceId, int? arg_clientInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setWebChromeClient', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_clientInstanceId]) - as List?; + await channel.send([arg_instanceId, arg_clientInstanceId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1018,8 +980,8 @@ class WebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setBackgroundColor', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_color]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_color]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1050,8 +1012,7 @@ abstract class WebViewFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int identifier); - static void setup(WebViewFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(WebViewFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewFlutterApi.create', codec, @@ -1061,7 +1022,7 @@ abstract class WebViewFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebViewFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1089,8 +1050,7 @@ class WebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.create', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_webViewInstanceId]) - as List?; + await channel.send([arg_instanceId, arg_webViewInstanceId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1111,8 +1071,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_flag]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_flag]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1129,14 +1089,12 @@ class WebSettingsHostApi { } } - Future setJavaScriptCanOpenWindowsAutomatically( - int arg_instanceId, bool arg_flag) async { + Future setJavaScriptCanOpenWindowsAutomatically(int arg_instanceId, bool arg_flag) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_flag]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_flag]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1153,14 +1111,12 @@ class WebSettingsHostApi { } } - Future setSupportMultipleWindows( - int arg_instanceId, bool arg_support) async { + Future setSupportMultipleWindows(int arg_instanceId, bool arg_support) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_support]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_support]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1181,8 +1137,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_flag]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_flag]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1199,13 +1155,12 @@ class WebSettingsHostApi { } } - Future setUserAgentString( - int arg_instanceId, String? arg_userAgentString) async { + Future setUserAgentString(int arg_instanceId, String? arg_userAgentString) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_userAgentString]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_userAgentString]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1222,14 +1177,12 @@ class WebSettingsHostApi { } } - Future setMediaPlaybackRequiresUserGesture( - int arg_instanceId, bool arg_require) async { + Future setMediaPlaybackRequiresUserGesture(int arg_instanceId, bool arg_require) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_require]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_require]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1250,8 +1203,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_support]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_support]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1268,13 +1221,12 @@ class WebSettingsHostApi { } } - Future setLoadWithOverviewMode( - int arg_instanceId, bool arg_overview) async { + Future setLoadWithOverviewMode(int arg_instanceId, bool arg_overview) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_overview]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_overview]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1295,8 +1247,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_use]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_use]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1313,13 +1265,12 @@ class WebSettingsHostApi { } } - Future setDisplayZoomControls( - int arg_instanceId, bool arg_enabled) async { + Future setDisplayZoomControls(int arg_instanceId, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_enabled]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1336,13 +1287,12 @@ class WebSettingsHostApi { } } - Future setBuiltInZoomControls( - int arg_instanceId, bool arg_enabled) async { + Future setBuiltInZoomControls(int arg_instanceId, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_enabled]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1363,8 +1313,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_enabled]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1385,8 +1335,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setTextZoom', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_textZoom]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_textZoom]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1418,8 +1368,8 @@ class JavaScriptChannelHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_channelName]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_channelName]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1442,8 +1392,7 @@ abstract class JavaScriptChannelFlutterApi { void postMessage(int instanceId, String message); - static void setup(JavaScriptChannelFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(JavaScriptChannelFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage', codec, @@ -1453,7 +1402,7 @@ abstract class JavaScriptChannelFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage was null.'); + 'Argument for dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1501,14 +1450,12 @@ class WebViewClientHostApi { } } - Future setSynchronousReturnValueForShouldOverrideUrlLoading( - int arg_instanceId, bool arg_value) async { + Future setSynchronousReturnValueForShouldOverrideUrlLoading(int arg_instanceId, bool arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', - codec, + 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_value]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_value]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1544,9 +1491,9 @@ class _WebViewClientFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebResourceErrorData.decode(readValue(buffer)!); - case 129: + case 129: return WebResourceRequestData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1561,22 +1508,17 @@ abstract class WebViewClientFlutterApi { void onPageFinished(int instanceId, int webViewInstanceId, String url); - void onReceivedRequestError(int instanceId, int webViewInstanceId, - WebResourceRequestData request, WebResourceErrorData error); + void onReceivedRequestError(int instanceId, int webViewInstanceId, WebResourceRequestData request, WebResourceErrorData error); - void onReceivedError(int instanceId, int webViewInstanceId, int errorCode, - String description, String failingUrl); + void onReceivedError(int instanceId, int webViewInstanceId, int errorCode, String description, String failingUrl); - void requestLoading( - int instanceId, int webViewInstanceId, WebResourceRequestData request); + void requestLoading(int instanceId, int webViewInstanceId, WebResourceRequestData request); void urlLoading(int instanceId, int webViewInstanceId, String url); - void doUpdateVisitedHistory( - int instanceId, int webViewInstanceId, String url, bool isReload); + void doUpdateVisitedHistory(int instanceId, int webViewInstanceId, String url, bool isReload); - static void setup(WebViewClientFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(WebViewClientFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted', codec, @@ -1586,7 +1528,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1611,7 +1553,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1629,15 +1571,14 @@ abstract class WebViewClientFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError', - codec, + 'dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1645,16 +1586,13 @@ abstract class WebViewClientFlutterApi { final int? arg_webViewInstanceId = (args[1] as int?); assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null int.'); - final WebResourceRequestData? arg_request = - (args[2] as WebResourceRequestData?); + final WebResourceRequestData? arg_request = (args[2] as WebResourceRequestData?); assert(arg_request != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null WebResourceRequestData.'); - final WebResourceErrorData? arg_error = - (args[3] as WebResourceErrorData?); + final WebResourceErrorData? arg_error = (args[3] as WebResourceErrorData?); assert(arg_error != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null WebResourceErrorData.'); - api.onReceivedRequestError(arg_instanceId!, arg_webViewInstanceId!, - arg_request!, arg_error!); + api.onReceivedRequestError(arg_instanceId!, arg_webViewInstanceId!, arg_request!, arg_error!); return; }); } @@ -1668,7 +1606,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1685,8 +1623,7 @@ abstract class WebViewClientFlutterApi { final String? arg_failingUrl = (args[4] as String?); assert(arg_failingUrl != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null String.'); - api.onReceivedError(arg_instanceId!, arg_webViewInstanceId!, - arg_errorCode!, arg_description!, arg_failingUrl!); + api.onReceivedError(arg_instanceId!, arg_webViewInstanceId!, arg_errorCode!, arg_description!, arg_failingUrl!); return; }); } @@ -1700,7 +1637,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1708,12 +1645,10 @@ abstract class WebViewClientFlutterApi { final int? arg_webViewInstanceId = (args[1] as int?); assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null, expected non-null int.'); - final WebResourceRequestData? arg_request = - (args[2] as WebResourceRequestData?); + final WebResourceRequestData? arg_request = (args[2] as WebResourceRequestData?); assert(arg_request != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null, expected non-null WebResourceRequestData.'); - api.requestLoading( - arg_instanceId!, arg_webViewInstanceId!, arg_request!); + api.requestLoading(arg_instanceId!, arg_webViewInstanceId!, arg_request!); return; }); } @@ -1727,7 +1662,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1745,15 +1680,14 @@ abstract class WebViewClientFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory', - codec, + 'dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1767,8 +1701,7 @@ abstract class WebViewClientFlutterApi { final bool? arg_isReload = (args[3] as bool?); assert(arg_isReload != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null, expected non-null bool.'); - api.doUpdateVisitedHistory( - arg_instanceId!, arg_webViewInstanceId!, arg_url!, arg_isReload!); + api.doUpdateVisitedHistory(arg_instanceId!, arg_webViewInstanceId!, arg_url!, arg_isReload!); return; }); } @@ -1812,22 +1745,19 @@ class DownloadListenerHostApi { abstract class DownloadListenerFlutterApi { static const MessageCodec codec = StandardMessageCodec(); - void onDownloadStart(int instanceId, String url, String userAgent, - String contentDisposition, String mimetype, int contentLength); + void onDownloadStart(int instanceId, String url, String userAgent, String contentDisposition, String mimetype, int contentLength); - static void setup(DownloadListenerFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(DownloadListenerFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart', - codec, + 'dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null.'); + 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1847,8 +1777,7 @@ abstract class DownloadListenerFlutterApi { final int? arg_contentLength = (args[5] as int?); assert(arg_contentLength != null, 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null int.'); - api.onDownloadStart(arg_instanceId!, arg_url!, arg_userAgent!, - arg_contentDisposition!, arg_mimetype!, arg_contentLength!); + api.onDownloadStart(arg_instanceId!, arg_url!, arg_userAgent!, arg_contentDisposition!, arg_mimetype!, arg_contentLength!); return; }); } @@ -1888,14 +1817,12 @@ class WebChromeClientHostApi { } } - Future setSynchronousReturnValueForOnShowFileChooser( - int arg_instanceId, bool arg_value) async { + Future setSynchronousReturnValueForOnShowFileChooser(int arg_instanceId, bool arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', - codec, + 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_value]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_value]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1952,8 +1879,7 @@ class FlutterAssetManagerHostApi { Future getAssetFilePathByName(String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', - codec, + 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_name]) as List?; @@ -1984,25 +1910,28 @@ abstract class WebChromeClientFlutterApi { void onProgressChanged(int instanceId, int webViewInstanceId, int progress); - Future> onShowFileChooser( - int instanceId, int webViewInstanceId, int paramsInstanceId); + Future> onShowFileChooser(int instanceId, int webViewInstanceId, int paramsInstanceId); /// Callback to Dart function `WebChromeClient.onPermissionRequest`. void onPermissionRequest(int instanceId, int requestInstanceId); - static void setup(WebChromeClientFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + /// Callback to Dart function `WebChromeClient.onShowCustomView`. + void onShowCustomView(int instanceId, int viewIdentifier, int callbackIdentifier); + + /// Callback to Dart function `WebChromeClient.onHideCustomView`. + void onHideCustomView(int instanceId); + + static void setup(WebChromeClientFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged', - codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -2013,23 +1942,21 @@ abstract class WebChromeClientFlutterApi { final int? arg_progress = (args[2] as int?); assert(arg_progress != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null, expected non-null int.'); - api.onProgressChanged( - arg_instanceId!, arg_webViewInstanceId!, arg_progress!); + api.onProgressChanged(arg_instanceId!, arg_webViewInstanceId!, arg_progress!); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser', - codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -2040,23 +1967,21 @@ abstract class WebChromeClientFlutterApi { final int? arg_paramsInstanceId = (args[2] as int?); assert(arg_paramsInstanceId != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null, expected non-null int.'); - final List output = await api.onShowFileChooser( - arg_instanceId!, arg_webViewInstanceId!, arg_paramsInstanceId!); + final List output = await api.onShowFileChooser(arg_instanceId!, arg_webViewInstanceId!, arg_paramsInstanceId!); return output; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest', - codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -2069,6 +1994,50 @@ abstract class WebChromeClientFlutterApi { }); } } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView', codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView was null, expected non-null int.'); + final int? arg_viewIdentifier = (args[1] as int?); + assert(arg_viewIdentifier != null, + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView was null, expected non-null int.'); + final int? arg_callbackIdentifier = (args[2] as int?); + assert(arg_callbackIdentifier != null, + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView was null, expected non-null int.'); + api.onShowCustomView(arg_instanceId!, arg_viewIdentifier!, arg_callbackIdentifier!); + return; + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onHideCustomView', codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onHideCustomView was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onHideCustomView was null, expected non-null int.'); + api.onHideCustomView(arg_instanceId!); + return; + }); + } + } } } @@ -2142,7 +2111,7 @@ class _FileChooserParamsFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return FileChooserModeEnumData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -2154,14 +2123,11 @@ class _FileChooserParamsFlutterApiCodec extends StandardMessageCodec { /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. abstract class FileChooserParamsFlutterApi { - static const MessageCodec codec = - _FileChooserParamsFlutterApiCodec(); + static const MessageCodec codec = _FileChooserParamsFlutterApiCodec(); - void create(int instanceId, bool isCaptureEnabled, List acceptTypes, - FileChooserModeEnumData mode, String? filenameHint); + void create(int instanceId, bool isCaptureEnabled, List acceptTypes, FileChooserModeEnumData mode, String? filenameHint); - static void setup(FileChooserParamsFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(FileChooserParamsFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FileChooserParamsFlutterApi.create', codec, @@ -2171,7 +2137,7 @@ abstract class FileChooserParamsFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -2179,17 +2145,14 @@ abstract class FileChooserParamsFlutterApi { final bool? arg_isCaptureEnabled = (args[1] as bool?); assert(arg_isCaptureEnabled != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null bool.'); - final List? arg_acceptTypes = - (args[2] as List?)?.cast(); + final List? arg_acceptTypes = (args[2] as List?)?.cast(); assert(arg_acceptTypes != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null List.'); - final FileChooserModeEnumData? arg_mode = - (args[3] as FileChooserModeEnumData?); + final FileChooserModeEnumData? arg_mode = (args[3] as FileChooserModeEnumData?); assert(arg_mode != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null FileChooserModeEnumData.'); final String? arg_filenameHint = (args[4] as String?); - api.create(arg_instanceId!, arg_isCaptureEnabled!, arg_acceptTypes!, - arg_mode!, arg_filenameHint); + api.create(arg_instanceId!, arg_isCaptureEnabled!, arg_acceptTypes!, arg_mode!, arg_filenameHint); return; }); } @@ -2219,8 +2182,8 @@ class PermissionRequestHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PermissionRequestHostApi.grant', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_resources]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_resources]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2274,8 +2237,7 @@ abstract class PermissionRequestFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int instanceId, List resources); - static void setup(PermissionRequestFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(PermissionRequestFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PermissionRequestFlutterApi.create', codec, @@ -2285,13 +2247,12 @@ abstract class PermissionRequestFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PermissionRequestFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.PermissionRequestFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.PermissionRequestFlutterApi.create was null, expected non-null int.'); - final List? arg_resources = - (args[1] as List?)?.cast(); + final List? arg_resources = (args[1] as List?)?.cast(); assert(arg_resources != null, 'Argument for dev.flutter.pigeon.PermissionRequestFlutterApi.create was null, expected non-null List.'); api.create(arg_instanceId!, arg_resources!); @@ -2322,8 +2283,7 @@ class CustomViewCallbackHostApi { /// Handles Dart method `CustomViewCallback.onCustomViewHidden`. Future onCustomViewHidden(int arg_identifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden', - codec, + 'dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_identifier]) as List?; @@ -2357,8 +2317,7 @@ abstract class CustomViewCallbackFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int identifier); - static void setup(CustomViewCallbackFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(CustomViewCallbackFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CustomViewCallbackFlutterApi.create', codec, @@ -2368,7 +2327,7 @@ abstract class CustomViewCallbackFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CustomViewCallbackFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.CustomViewCallbackFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2404,7 +2363,7 @@ abstract class ViewFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ViewFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.ViewFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart index 53d352a67f3f..b8b813ee1577 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart @@ -954,6 +954,34 @@ class WebChromeClientFlutterApiImpl extends WebChromeClientFlutterApi { request.deny(); } } + + @override + void onShowCustomView( + int instanceId, + int viewIdentifier, + int callbackIdentifier, + ) { + final WebChromeClient instance = + instanceManager.getInstanceWithWeakReference(instanceId)!; + if (instance.onShowCustomView != null) { + return instance.onShowCustomView!( + instance, + instanceManager.getInstanceWithWeakReference(viewIdentifier)!, + instanceManager.getInstanceWithWeakReference(callbackIdentifier)!, + ); + } + } + + @override + void onHideCustomView(int instanceId) { + final WebChromeClient instance = + instanceManager.getInstanceWithWeakReference(instanceId)!; + if (instance.onHideCustomView != null) { + return instance.onHideCustomView!( + instance, + ); + } + } } /// Host api implementation for [WebStorage]. diff --git a/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart b/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart index 65835e34dc62..24290ad8ce34 100644 --- a/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart +++ b/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart @@ -365,6 +365,16 @@ abstract class WebChromeClientFlutterApi { /// Callback to Dart function `WebChromeClient.onPermissionRequest`. void onPermissionRequest(int instanceId, int requestInstanceId); + + /// Callback to Dart function `WebChromeClient.onShowCustomView`. + void onShowCustomView( + int instanceId, + int viewIdentifier, + int callbackIdentifier, + ); + + /// Callback to Dart function `WebChromeClient.onHideCustomView`. + void onHideCustomView(int instanceId); } @HostApi(dartHostTestHandler: 'TestWebStorageHostApi') diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_test.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_test.dart index 470ad718d005..80b40ec709be 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_test.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_test.dart @@ -1015,6 +1015,88 @@ void main() { expect(callbackParameters, [instance, request]); }); + test('onShowCustomView', () { + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + + const int instanceIdentifier = 0; + late final List callbackParameters; + final WebChromeClient instance = WebChromeClient.detached( + onShowCustomView: ( + WebChromeClient instance, + View view, + CustomViewCallback callback, + ) { + callbackParameters = [ + instance, + view, + callback, + ]; + }, + instanceManager: instanceManager, + ); + instanceManager.addHostCreatedInstance(instance, instanceIdentifier); + + final WebChromeClientFlutterApiImpl flutterApi = + WebChromeClientFlutterApiImpl( + instanceManager: instanceManager, + ); + + final View view = View.detached( + instanceManager: instanceManager, + ); + const int viewIdentifier = 50; + instanceManager.addHostCreatedInstance(view, viewIdentifier); + + final CustomViewCallback callback = CustomViewCallback.detached( + instanceManager: instanceManager, + ); + const int callbackIdentifier = 51; + instanceManager.addHostCreatedInstance(callback, callbackIdentifier); + + flutterApi.onShowCustomView( + instanceIdentifier, + viewIdentifier, + callbackIdentifier, + ); + + expect(callbackParameters, [ + instance, + view, + callback, + ]); + }); + + test('onHideCustomView', () { + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + + const int instanceIdentifier = 0; + late final List callbackParameters; + final WebChromeClient instance = WebChromeClient.detached( + onHideCustomView: ( + WebChromeClient instance, + ) { + callbackParameters = [ + instance, + ]; + }, + instanceManager: instanceManager, + ); + instanceManager.addHostCreatedInstance(instance, instanceIdentifier); + + final WebChromeClientFlutterApiImpl flutterApi = + WebChromeClientFlutterApiImpl( + instanceManager: instanceManager, + ); + + flutterApi.onHideCustomView(instanceIdentifier); + + expect(callbackParameters, [instance]); + }); + test('copy', () { expect(WebChromeClient.detached().copy(), isA()); }); diff --git a/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart index dc4e4bce860c..0306fbffb5e5 100644 --- a/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart +++ b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart @@ -15,8 +15,7 @@ import 'package:webview_flutter_android/src/android_webview.g.dart'; /// Host API for managing the native `InstanceManager`. abstract class TestInstanceManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Clear the native `InstanceManager`. @@ -24,19 +23,15 @@ abstract class TestInstanceManagerHostApi { /// This is typically only used after a hot restart. void clear(); - static void setup(TestInstanceManagerHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestInstanceManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.InstanceManagerHostApi.clear', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { // ignore message api.clear(); return []; @@ -52,27 +47,22 @@ abstract class TestInstanceManagerHostApi { /// /// See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. abstract class TestJavaObjectHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void dispose(int identifier); - static void setup(TestJavaObjectHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestJavaObjectHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaObjectHostApi.dispose', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -91,8 +81,7 @@ abstract class TestJavaObjectHostApi { /// are attached to a Dart instance or handle method calls on the associated /// native class or an instance of the class. abstract class TestCookieManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Handles attaching `CookieManager.instance` to a native instance. @@ -105,24 +94,19 @@ abstract class TestCookieManagerHostApi { Future removeAllCookies(int identifier); /// Handles Dart method `CookieManager.setAcceptThirdPartyCookies`. - void setAcceptThirdPartyCookies( - int identifier, int webViewIdentifier, bool accept); + void setAcceptThirdPartyCookies(int identifier, int webViewIdentifier, bool accept); - static void setup(TestCookieManagerHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestCookieManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CookieManagerHostApi.attachInstance', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CookieManagerHostApi.attachInstance was null.'); + 'Argument for dev.flutter.pigeon.CookieManagerHostApi.attachInstance was null.'); final List args = (message as List?)!; final int? arg_instanceIdentifier = (args[0] as int?); assert(arg_instanceIdentifier != null, @@ -137,14 +121,11 @@ abstract class TestCookieManagerHostApi { 'dev.flutter.pigeon.CookieManagerHostApi.setCookie', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setCookie was null.'); + 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setCookie was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -165,14 +146,11 @@ abstract class TestCookieManagerHostApi { 'dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies was null.'); + 'Argument for dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -184,18 +162,14 @@ abstract class TestCookieManagerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies', - codec, + 'dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies was null.'); + 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -206,8 +180,7 @@ abstract class TestCookieManagerHostApi { final bool? arg_accept = (args[2] as bool?); assert(arg_accept != null, 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies was null, expected non-null bool.'); - api.setAcceptThirdPartyCookies( - arg_identifier!, arg_webViewIdentifier!, arg_accept!); + api.setAcceptThirdPartyCookies(arg_identifier!, arg_webViewIdentifier!, arg_accept!); return []; }); } @@ -230,7 +203,7 @@ class _TestWebViewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebViewPoint.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -239,17 +212,14 @@ class _TestWebViewHostApiCodec extends StandardMessageCodec { } abstract class TestWebViewHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestWebViewHostApiCodec(); void create(int instanceId); - void loadData( - int instanceId, String data, String? mimeType, String? encoding); + void loadData(int instanceId, String data, String? mimeType, String? encoding); - void loadDataWithBaseUrl(int instanceId, String? baseUrl, String data, - String? mimeType, String? encoding, String? historyUrl); + void loadDataWithBaseUrl(int instanceId, String? baseUrl, String data, String? mimeType, String? encoding, String? historyUrl); void loadUrl(int instanceId, String url, Map headers); @@ -297,21 +267,17 @@ abstract class TestWebViewHostApi { void setBackgroundColor(int instanceId, int color); - static void setup(TestWebViewHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebViewHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -326,14 +292,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.loadData', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -353,14 +316,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -372,8 +332,7 @@ abstract class TestWebViewHostApi { final String? arg_mimeType = (args[3] as String?); final String? arg_encoding = (args[4] as String?); final String? arg_historyUrl = (args[5] as String?); - api.loadDataWithBaseUrl(arg_instanceId!, arg_baseUrl, arg_data!, - arg_mimeType, arg_encoding, arg_historyUrl); + api.loadDataWithBaseUrl(arg_instanceId!, arg_baseUrl, arg_data!, arg_mimeType, arg_encoding, arg_historyUrl); return []; }); } @@ -383,14 +342,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.loadUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -398,8 +354,7 @@ abstract class TestWebViewHostApi { final String? arg_url = (args[1] as String?); assert(arg_url != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null String.'); - final Map? arg_headers = - (args[2] as Map?)?.cast(); + final Map? arg_headers = (args[2] as Map?)?.cast(); assert(arg_headers != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null Map.'); api.loadUrl(arg_instanceId!, arg_url!, arg_headers!); @@ -412,14 +367,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.postUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -440,14 +392,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -462,14 +411,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.canGoBack', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoBack was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -484,14 +430,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.canGoForward', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoForward was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -506,14 +449,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.goBack', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.goBack was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.goBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -528,14 +468,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.goForward', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.goForward was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.goForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -550,14 +487,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.reload', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.reload was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.reload was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -572,14 +506,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.clearCache', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -597,14 +528,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.evaluateJavascript', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -612,8 +540,7 @@ abstract class TestWebViewHostApi { final String? arg_javascriptString = (args[1] as String?); assert(arg_javascriptString != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null, expected non-null String.'); - final String? output = await api.evaluateJavascript( - arg_instanceId!, arg_javascriptString!); + final String? output = await api.evaluateJavascript(arg_instanceId!, arg_javascriptString!); return [output]; }); } @@ -623,14 +550,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getTitle', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getTitle was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getTitle was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -645,14 +569,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.scrollTo', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -673,14 +594,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.scrollBy', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -701,14 +619,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getScrollX', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollX was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollX was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -723,14 +638,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getScrollY', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollY was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollY was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -745,14 +657,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getScrollPosition', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollPosition was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollPosition was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -764,18 +673,14 @@ abstract class TestWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', - codec, + 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled was null.'); final List args = (message as List?)!; final bool? arg_enabled = (args[0] as bool?); assert(arg_enabled != null, @@ -790,14 +695,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setWebViewClient', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -815,14 +717,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -830,8 +729,7 @@ abstract class TestWebViewHostApi { final int? arg_javaScriptChannelInstanceId = (args[1] as int?); assert(arg_javaScriptChannelInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null, expected non-null int.'); - api.addJavaScriptChannel( - arg_instanceId!, arg_javaScriptChannelInstanceId!); + api.addJavaScriptChannel(arg_instanceId!, arg_javaScriptChannelInstanceId!); return []; }); } @@ -841,14 +739,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -856,8 +751,7 @@ abstract class TestWebViewHostApi { final int? arg_javaScriptChannelInstanceId = (args[1] as int?); assert(arg_javaScriptChannelInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null, expected non-null int.'); - api.removeJavaScriptChannel( - arg_instanceId!, arg_javaScriptChannelInstanceId!); + api.removeJavaScriptChannel(arg_instanceId!, arg_javaScriptChannelInstanceId!); return []; }); } @@ -867,14 +761,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setDownloadListener', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -890,14 +781,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setWebChromeClient', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -913,14 +801,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setBackgroundColor', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -937,8 +822,7 @@ abstract class TestWebViewHostApi { } abstract class TestWebSettingsHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId, int webViewInstanceId); @@ -969,21 +853,17 @@ abstract class TestWebSettingsHostApi { void setTextZoom(int instanceId, int textZoom); - static void setup(TestWebSettingsHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebSettingsHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1001,14 +881,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1023,18 +900,14 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1042,26 +915,21 @@ abstract class TestWebSettingsHostApi { final bool? arg_flag = (args[1] as bool?); assert(arg_flag != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null, expected non-null bool.'); - api.setJavaScriptCanOpenWindowsAutomatically( - arg_instanceId!, arg_flag!); + api.setJavaScriptCanOpenWindowsAutomatically(arg_instanceId!, arg_flag!); return []; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1079,14 +947,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1104,14 +969,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1124,18 +986,14 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1143,8 +1001,7 @@ abstract class TestWebSettingsHostApi { final bool? arg_require = (args[1] as bool?); assert(arg_require != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null, expected non-null bool.'); - api.setMediaPlaybackRequiresUserGesture( - arg_instanceId!, arg_require!); + api.setMediaPlaybackRequiresUserGesture(arg_instanceId!, arg_require!); return []; }); } @@ -1154,14 +1011,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1176,18 +1030,14 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1205,14 +1055,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1230,14 +1077,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1255,14 +1099,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1280,14 +1121,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1305,14 +1143,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setTextZoom', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setTextZoom was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setTextZoom was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1329,27 +1164,22 @@ abstract class TestWebSettingsHostApi { } abstract class TestJavaScriptChannelHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId, String channelName); - static void setup(TestJavaScriptChannelHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestJavaScriptChannelHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1366,30 +1196,24 @@ abstract class TestJavaScriptChannelHostApi { } abstract class TestWebViewClientHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - void setSynchronousReturnValueForShouldOverrideUrlLoading( - int instanceId, bool value); + void setSynchronousReturnValueForShouldOverrideUrlLoading(int instanceId, bool value); - static void setup(TestWebViewClientHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebViewClientHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewClientHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1401,18 +1225,14 @@ abstract class TestWebViewClientHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', - codec, + 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1420,8 +1240,7 @@ abstract class TestWebViewClientHostApi { final bool? arg_value = (args[1] as bool?); assert(arg_value != null, 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null, expected non-null bool.'); - api.setSynchronousReturnValueForShouldOverrideUrlLoading( - arg_instanceId!, arg_value!); + api.setSynchronousReturnValueForShouldOverrideUrlLoading(arg_instanceId!, arg_value!); return []; }); } @@ -1430,27 +1249,22 @@ abstract class TestWebViewClientHostApi { } abstract class TestDownloadListenerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - static void setup(TestDownloadListenerHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestDownloadListenerHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.DownloadListenerHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.DownloadListenerHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.DownloadListenerHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1464,30 +1278,24 @@ abstract class TestDownloadListenerHostApi { } abstract class TestWebChromeClientHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - void setSynchronousReturnValueForOnShowFileChooser( - int instanceId, bool value); + void setSynchronousReturnValueForOnShowFileChooser(int instanceId, bool value); - static void setup(TestWebChromeClientHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebChromeClientHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebChromeClientHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1499,18 +1307,14 @@ abstract class TestWebChromeClientHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', - codec, + 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1518,8 +1322,7 @@ abstract class TestWebChromeClientHostApi { final bool? arg_value = (args[1] as bool?); assert(arg_value != null, 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null, expected non-null bool.'); - api.setSynchronousReturnValueForOnShowFileChooser( - arg_instanceId!, arg_value!); + api.setSynchronousReturnValueForOnShowFileChooser(arg_instanceId!, arg_value!); return []; }); } @@ -1528,29 +1331,24 @@ abstract class TestWebChromeClientHostApi { } abstract class TestAssetManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); List list(String path); String getAssetFilePathByName(String name); - static void setup(TestAssetManagerHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestAssetManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FlutterAssetManagerHostApi.list', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.list was null.'); + 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.list was null.'); final List args = (message as List?)!; final String? arg_path = (args[0] as String?); assert(arg_path != null, @@ -1562,18 +1360,14 @@ abstract class TestAssetManagerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', - codec, + 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName was null.'); + 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName was null.'); final List args = (message as List?)!; final String? arg_name = (args[0] as String?); assert(arg_name != null, @@ -1587,29 +1381,24 @@ abstract class TestAssetManagerHostApi { } abstract class TestWebStorageHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); void deleteAllData(int instanceId); - static void setup(TestWebStorageHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebStorageHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebStorageHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebStorageHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebStorageHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1624,14 +1413,11 @@ abstract class TestWebStorageHostApi { 'dev.flutter.pigeon.WebStorageHostApi.deleteAllData', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebStorageHostApi.deleteAllData was null.'); + 'Argument for dev.flutter.pigeon.WebStorageHostApi.deleteAllData was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1652,8 +1438,7 @@ abstract class TestWebStorageHostApi { /// /// See https://developer.android.com/reference/android/webkit/PermissionRequest. abstract class TestPermissionRequestHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Handles Dart method `PermissionRequest.grant`. @@ -1662,27 +1447,22 @@ abstract class TestPermissionRequestHostApi { /// Handles Dart method `PermissionRequest.deny`. void deny(int instanceId); - static void setup(TestPermissionRequestHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestPermissionRequestHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PermissionRequestHostApi.grant', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null.'); + 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null, expected non-null int.'); - final List? arg_resources = - (args[1] as List?)?.cast(); + final List? arg_resources = (args[1] as List?)?.cast(); assert(arg_resources != null, 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null, expected non-null List.'); api.grant(arg_instanceId!, arg_resources!); @@ -1695,14 +1475,11 @@ abstract class TestPermissionRequestHostApi { 'dev.flutter.pigeon.PermissionRequestHostApi.deny', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.deny was null.'); + 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.deny was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1723,29 +1500,23 @@ abstract class TestPermissionRequestHostApi { /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. abstract class TestCustomViewCallbackHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Handles Dart method `CustomViewCallback.onCustomViewHidden`. void onCustomViewHidden(int identifier); - static void setup(TestCustomViewCallbackHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestCustomViewCallbackHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden', - codec, + 'dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden was null.'); + 'Argument for dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, From e9295b27036c252e7805fe25bf07e8be3f6500c6 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Tue, 30 May 2023 12:40:53 -0400 Subject: [PATCH 11/35] implement java side --- .../CustomViewCallbackFlutterApiImpl.java | 6 +- .../CustomViewCallbackHostApiImpl.java | 8 +- ...ewFactory.java => FlutterViewFactory.java} | 6 +- .../GeneratedAndroidWebView.java | 912 +++++++++++------- .../webviewflutter/ViewFlutterApiImpl.java | 4 +- .../WebChromeClientFlutterApiImpl.java | 32 + .../WebChromeClientHostApiImpl.java | 101 +- .../webviewflutter/WebViewFlutterPlugin.java | 18 +- .../CustomViewCallbackTest.java | 8 +- .../plugins/webviewflutter/ViewTest.java | 7 +- .../webviewflutter/WebChromeClientTest.java | 76 +- .../lib/src/android_webview.g.dart | 415 +++++--- .../test/test_android_webview.g.dart | 687 ++++++++----- 13 files changed, 1424 insertions(+), 856 deletions(-) rename packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/{FlutterWebViewFactory.java => FlutterViewFactory.java} (83%) diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackFlutterApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackFlutterApiImpl.java index 9627f0e995fe..ffe70f694164 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackFlutterApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackFlutterApiImpl.java @@ -1,13 +1,10 @@ - // 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. -// TODO(bparrishMines): Remove GenApiImpls from filename or copy classes/methods to your own implementation - package io.flutter.plugins.webviewflutter; -// TODO(bparrishMines): Import native classes +import android.webkit.WebChromeClient.CustomViewCallback; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; import io.flutter.plugin.common.BinaryMessenger; @@ -20,7 +17,6 @@ * arguments of callbacks methods to a Dart instance. */ public class CustomViewCallbackFlutterApiImpl { - // To ease adding additional methods, this value is added prematurely. @SuppressWarnings({"unused", "FieldCanBeLocal"}) private final BinaryMessenger binaryMessenger; diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackHostApiImpl.java index 78d1296ce137..44b8c454cc65 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackHostApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/CustomViewCallbackHostApiImpl.java @@ -1,13 +1,10 @@ - // 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. -// TODO(bparrishMines): Remove GenApiImpls from filename or copy classes/methods to your own implementation - package io.flutter.plugins.webviewflutter; -// TODO(bparrishMines): Import native classes +import android.webkit.WebChromeClient.CustomViewCallback; import androidx.annotation.NonNull; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.CustomViewCallbackHostApi; @@ -20,7 +17,6 @@ * Dart instance or handle method calls on the associated native class or an instance of the class. */ public class CustomViewCallbackHostApiImpl implements CustomViewCallbackHostApi { - // To ease adding additional methods, this value is added prematurely. @SuppressWarnings({"unused", "FieldCanBeLocal"}) private final BinaryMessenger binaryMessenger; @@ -35,14 +31,12 @@ public class CustomViewCallbackHostApiImpl implements CustomViewCallbackHostApi */ public CustomViewCallbackHostApiImpl( @NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { - this.binaryMessenger = binaryMessenger; this.instanceManager = instanceManager; } @Override public void onCustomViewHidden(@NonNull Long identifier) { - getCustomViewCallbackInstance(identifier).onCustomViewHidden(); } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterWebViewFactory.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterViewFactory.java similarity index 83% rename from packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterWebViewFactory.java rename to packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterViewFactory.java index ec99e996ae06..985149329ad9 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterWebViewFactory.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterViewFactory.java @@ -11,10 +11,10 @@ import io.flutter.plugin.platform.PlatformView; import io.flutter.plugin.platform.PlatformViewFactory; -class FlutterWebViewFactory extends PlatformViewFactory { +class FlutterViewFactory extends PlatformViewFactory { private final InstanceManager instanceManager; - FlutterWebViewFactory(InstanceManager instanceManager) { + FlutterViewFactory(InstanceManager instanceManager) { super(StandardMessageCodec.INSTANCE); this.instanceManager = instanceManager; } @@ -29,7 +29,7 @@ public PlatformView create(Context context, int viewId, @Nullable Object args) { final PlatformView view = instanceManager.getInstance(identifier); if (view == null) { - throw new IllegalStateException("Unable to find WebView instance: " + args); + throw new IllegalStateException("Unable to find View instance: " + args); } return view; } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java index c09280287098..662be0848e99 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java @@ -18,7 +18,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -35,8 +34,7 @@ public static class FlutterError extends RuntimeException { /** The error details. Must be a datatype supported by the api codec. */ public final Object details; - public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) - { + public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) { super(message); this.code = code; this.details = details; @@ -55,7 +53,7 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); } return errorList; } @@ -63,26 +61,29 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { /** * Mode of how to select files for a file chooser. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. */ public enum FileChooserMode { /** - * Open single file and requires that the file exists before allowing the - * user to pick it. + * Open single file and requires that the file exists before allowing the user to pick it. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN. + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN. */ OPEN(0), /** * Similar to [open] but allows multiple files to be selected. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE. + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE. */ OPEN_MULTIPLE(1), /** * Allows picking a nonexistent file and saving it. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE. + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE. */ SAVE(2); @@ -374,7 +375,10 @@ ArrayList toList() { static @NonNull WebResourceErrorData fromList(@NonNull ArrayList list) { WebResourceErrorData pigeonResult = new WebResourceErrorData(); Object errorCode = list.get(0); - pigeonResult.setErrorCode((errorCode == null) ? null : ((errorCode instanceof Integer) ? (Integer) errorCode : (Long) errorCode)); + pigeonResult.setErrorCode( + (errorCode == null) + ? null + : ((errorCode instanceof Integer) ? (Integer) errorCode : (Long) errorCode)); Object description = list.get(1); pigeonResult.setDescription((String) description); return pigeonResult; @@ -463,13 +467,13 @@ public interface Result { /** * Host API for managing the native `InstanceManager`. * - * Generated interface from Pigeon that represents a handler of messages from Flutter. + *

Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface InstanceManagerHostApi { /** * Clear the native `InstanceManager`. * - * This is typically only used after a hot restart. + *

This is typically only used after a hot restart. */ void clear(); @@ -477,8 +481,12 @@ public interface InstanceManagerHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `InstanceManagerHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable InstanceManagerHostApi api) { + /** + * Sets up an instance of `InstanceManagerHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable InstanceManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -490,8 +498,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable InstanceMa try { api.clear(); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -506,11 +513,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable InstanceMa /** * Handles methods calls to the native Java Object class. * - * Also handles calls to remove the reference to an instance with `dispose`. + *

Also handles calls to remove the reference to an instance with `dispose`. * - * See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. + *

See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. * - * Generated interface from Pigeon that represents a handler of messages from Flutter. + *

Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface JavaObjectHostApi { @@ -520,7 +527,9 @@ public interface JavaObjectHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObjectHostApi api) { { BasicMessageChannel channel = @@ -535,8 +544,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObject try { api.dispose((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -551,9 +559,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObject /** * Handles callbacks methods for the native Java Object class. * - * See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. + *

See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. * - * Generated class from Pigeon that represents Flutter messages that can be called from Java. + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class JavaObjectFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -562,7 +570,7 @@ public JavaObjectFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -571,6 +579,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void dispose(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -583,11 +592,11 @@ public void dispose(@NonNull Long identifierArg, @NonNull Reply callback) /** * Host API for `CookieManager`. * - * This class may handle instantiating and adding native object instances that - * are attached to a Dart instance or handle method calls on the associated - * native class or an instance of the class. + *

This class may handle instantiating and adding native object instances that are attached to + * a Dart instance or handle method calls on the associated native class or an instance of the + * class. * - * Generated interface from Pigeon that represents a handler of messages from Flutter. + *

Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CookieManagerHostApi { /** Handles attaching `CookieManager.instance` to a native instance. */ @@ -597,18 +606,25 @@ public interface CookieManagerHostApi { /** Handles Dart method `CookieManager.removeAllCookies`. */ void removeAllCookies(@NonNull Long identifier, @NonNull Result result); /** Handles Dart method `CookieManager.setAcceptThirdPartyCookies`. */ - void setAcceptThirdPartyCookies(@NonNull Long identifier, @NonNull Long webViewIdentifier, @NonNull Boolean accept); + void setAcceptThirdPartyCookies( + @NonNull Long identifier, @NonNull Long webViewIdentifier, @NonNull Boolean accept); /** The codec used by CookieManagerHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `CookieManagerHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CookieManagerHostApi api) { + /** + * Sets up an instance of `CookieManagerHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable CookieManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.CookieManagerHostApi.attachInstance", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.CookieManagerHostApi.attachInstance", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -616,10 +632,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CookieMana ArrayList args = (ArrayList) message; Number instanceIdentifierArg = (Number) args.get(0); try { - api.attachInstance((instanceIdentifierArg == null) ? null : instanceIdentifierArg.longValue()); + api.attachInstance( + (instanceIdentifierArg == null) ? null : instanceIdentifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -642,10 +658,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CookieMana String urlArg = (String) args.get(1); String valueArg = (String) args.get(2); try { - api.setCookie((identifierArg == null) ? null : identifierArg.longValue(), urlArg, valueArg); + api.setCookie( + (identifierArg == null) ? null : identifierArg.longValue(), urlArg, valueArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -658,7 +674,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CookieMana { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -678,7 +696,8 @@ public void error(Throwable error) { } }; - api.removeAllCookies((identifierArg == null) ? null : identifierArg.longValue(), resultCallback); + api.removeAllCookies( + (identifierArg == null) ? null : identifierArg.longValue(), resultCallback); }); } else { channel.setMessageHandler(null); @@ -687,7 +706,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -697,10 +718,12 @@ public void error(Throwable error) { Number webViewIdentifierArg = (Number) args.get(1); Boolean acceptArg = (Boolean) args.get(2); try { - api.setAcceptThirdPartyCookies((identifierArg == null) ? null : identifierArg.longValue(), (webViewIdentifierArg == null) ? null : webViewIdentifierArg.longValue(), acceptArg); + api.setAcceptThirdPartyCookies( + (identifierArg == null) ? null : identifierArg.longValue(), + (webViewIdentifierArg == null) ? null : webViewIdentifierArg.longValue(), + acceptArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -744,21 +767,32 @@ public interface WebViewHostApi { void create(@NonNull Long instanceId); - void loadData(@NonNull Long instanceId, @NonNull String data, @Nullable String mimeType, @Nullable String encoding); + void loadData( + @NonNull Long instanceId, + @NonNull String data, + @Nullable String mimeType, + @Nullable String encoding); - void loadDataWithBaseUrl(@NonNull Long instanceId, @Nullable String baseUrl, @NonNull String data, @Nullable String mimeType, @Nullable String encoding, @Nullable String historyUrl); + void loadDataWithBaseUrl( + @NonNull Long instanceId, + @Nullable String baseUrl, + @NonNull String data, + @Nullable String mimeType, + @Nullable String encoding, + @Nullable String historyUrl); - void loadUrl(@NonNull Long instanceId, @NonNull String url, @NonNull Map headers); + void loadUrl( + @NonNull Long instanceId, @NonNull String url, @NonNull Map headers); void postUrl(@NonNull Long instanceId, @NonNull String url, @NonNull byte[] data); - @Nullable + @Nullable String getUrl(@NonNull Long instanceId); - @NonNull + @NonNull Boolean canGoBack(@NonNull Long instanceId); - @NonNull + @NonNull Boolean canGoForward(@NonNull Long instanceId); void goBack(@NonNull Long instanceId); @@ -769,22 +803,23 @@ public interface WebViewHostApi { void clearCache(@NonNull Long instanceId, @NonNull Boolean includeDiskFiles); - void evaluateJavascript(@NonNull Long instanceId, @NonNull String javascriptString, @NonNull Result result); + void evaluateJavascript( + @NonNull Long instanceId, @NonNull String javascriptString, @NonNull Result result); - @Nullable + @Nullable String getTitle(@NonNull Long instanceId); void scrollTo(@NonNull Long instanceId, @NonNull Long x, @NonNull Long y); void scrollBy(@NonNull Long instanceId, @NonNull Long x, @NonNull Long y); - @NonNull + @NonNull Long getScrollX(@NonNull Long instanceId); - @NonNull + @NonNull Long getScrollY(@NonNull Long instanceId); - @NonNull + @NonNull WebViewPoint getScrollPosition(@NonNull Long instanceId); void setWebContentsDebuggingEnabled(@NonNull Boolean enabled); @@ -793,7 +828,8 @@ public interface WebViewHostApi { void addJavaScriptChannel(@NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId); - void removeJavaScriptChannel(@NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId); + void removeJavaScriptChannel( + @NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId); void setDownloadListener(@NonNull Long instanceId, @Nullable Long listenerInstanceId); @@ -805,7 +841,7 @@ public interface WebViewHostApi { static @NonNull MessageCodec getCodec() { return WebViewHostApiCodec.INSTANCE; } - /**Sets up an instance of `WebViewHostApi` to handle messages through the `binaryMessenger`. */ + /** Sets up an instance of `WebViewHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHostApi api) { { BasicMessageChannel channel = @@ -820,8 +856,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -845,10 +880,13 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos String mimeTypeArg = (String) args.get(2); String encodingArg = (String) args.get(3); try { - api.loadData((instanceIdArg == null) ? null : instanceIdArg.longValue(), dataArg, mimeTypeArg, encodingArg); + api.loadData( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + dataArg, + mimeTypeArg, + encodingArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -861,7 +899,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -874,10 +914,15 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos String encodingArg = (String) args.get(4); String historyUrlArg = (String) args.get(5); try { - api.loadDataWithBaseUrl((instanceIdArg == null) ? null : instanceIdArg.longValue(), baseUrlArg, dataArg, mimeTypeArg, encodingArg, historyUrlArg); + api.loadDataWithBaseUrl( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + baseUrlArg, + dataArg, + mimeTypeArg, + encodingArg, + historyUrlArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -900,10 +945,12 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos String urlArg = (String) args.get(1); Map headersArg = (Map) args.get(2); try { - api.loadUrl((instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, headersArg); + api.loadUrl( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + urlArg, + headersArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -926,10 +973,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos String urlArg = (String) args.get(1); byte[] dataArg = (byte[]) args.get(2); try { - api.postUrl((instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, dataArg); + api.postUrl( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, dataArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -950,10 +997,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - String output = api.getUrl((instanceIdArg == null) ? null : instanceIdArg.longValue()); + String output = + api.getUrl((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -974,10 +1021,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - Boolean output = api.canGoBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); + Boolean output = + api.canGoBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -998,10 +1045,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - Boolean output = api.canGoForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); + Boolean output = + api.canGoForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1024,8 +1071,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos try { api.goBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1048,8 +1094,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos try { api.goForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1072,8 +1117,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos try { api.reload((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1095,10 +1139,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos Number instanceIdArg = (Number) args.get(0); Boolean includeDiskFilesArg = (Boolean) args.get(1); try { - api.clearCache((instanceIdArg == null) ? null : instanceIdArg.longValue(), includeDiskFilesArg); + api.clearCache( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + includeDiskFilesArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1111,7 +1156,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.evaluateJavascript", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.evaluateJavascript", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1132,7 +1179,10 @@ public void error(Throwable error) { } }; - api.evaluateJavascript((instanceIdArg == null) ? null : instanceIdArg.longValue(), javascriptStringArg, resultCallback); + api.evaluateJavascript( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + javascriptStringArg, + resultCallback); }); } else { channel.setMessageHandler(null); @@ -1149,10 +1199,10 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - String output = api.getTitle((instanceIdArg == null) ? null : instanceIdArg.longValue()); + String output = + api.getTitle((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1175,10 +1225,12 @@ public void error(Throwable error) { Number xArg = (Number) args.get(1); Number yArg = (Number) args.get(2); try { - api.scrollTo((instanceIdArg == null) ? null : instanceIdArg.longValue(), (xArg == null) ? null : xArg.longValue(), (yArg == null) ? null : yArg.longValue()); + api.scrollTo( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (xArg == null) ? null : xArg.longValue(), + (yArg == null) ? null : yArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1201,10 +1253,12 @@ public void error(Throwable error) { Number xArg = (Number) args.get(1); Number yArg = (Number) args.get(2); try { - api.scrollBy((instanceIdArg == null) ? null : instanceIdArg.longValue(), (xArg == null) ? null : xArg.longValue(), (yArg == null) ? null : yArg.longValue()); + api.scrollBy( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (xArg == null) ? null : xArg.longValue(), + (yArg == null) ? null : yArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1225,10 +1279,10 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - Long output = api.getScrollX((instanceIdArg == null) ? null : instanceIdArg.longValue()); + Long output = + api.getScrollX((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1249,10 +1303,10 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - Long output = api.getScrollY((instanceIdArg == null) ? null : instanceIdArg.longValue()); + Long output = + api.getScrollY((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1273,10 +1327,11 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - WebViewPoint output = api.getScrollPosition((instanceIdArg == null) ? null : instanceIdArg.longValue()); + WebViewPoint output = + api.getScrollPosition( + (instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1289,7 +1344,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1299,8 +1356,7 @@ public void error(Throwable error) { try { api.setWebContentsDebuggingEnabled(enabledArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1322,10 +1378,13 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number webViewClientInstanceIdArg = (Number) args.get(1); try { - api.setWebViewClient((instanceIdArg == null) ? null : instanceIdArg.longValue(), (webViewClientInstanceIdArg == null) ? null : webViewClientInstanceIdArg.longValue()); + api.setWebViewClient( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (webViewClientInstanceIdArg == null) + ? null + : webViewClientInstanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1338,7 +1397,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1347,10 +1408,13 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number javaScriptChannelInstanceIdArg = (Number) args.get(1); try { - api.addJavaScriptChannel((instanceIdArg == null) ? null : instanceIdArg.longValue(), (javaScriptChannelInstanceIdArg == null) ? null : javaScriptChannelInstanceIdArg.longValue()); + api.addJavaScriptChannel( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (javaScriptChannelInstanceIdArg == null) + ? null + : javaScriptChannelInstanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1363,7 +1427,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1372,10 +1438,13 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number javaScriptChannelInstanceIdArg = (Number) args.get(1); try { - api.removeJavaScriptChannel((instanceIdArg == null) ? null : instanceIdArg.longValue(), (javaScriptChannelInstanceIdArg == null) ? null : javaScriptChannelInstanceIdArg.longValue()); + api.removeJavaScriptChannel( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (javaScriptChannelInstanceIdArg == null) + ? null + : javaScriptChannelInstanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1388,7 +1457,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setDownloadListener", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.setDownloadListener", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1397,10 +1468,11 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number listenerInstanceIdArg = (Number) args.get(1); try { - api.setDownloadListener((instanceIdArg == null) ? null : instanceIdArg.longValue(), (listenerInstanceIdArg == null) ? null : listenerInstanceIdArg.longValue()); + api.setDownloadListener( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (listenerInstanceIdArg == null) ? null : listenerInstanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1413,7 +1485,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setWebChromeClient", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.setWebChromeClient", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1422,10 +1496,11 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number clientInstanceIdArg = (Number) args.get(1); try { - api.setWebChromeClient((instanceIdArg == null) ? null : instanceIdArg.longValue(), (clientInstanceIdArg == null) ? null : clientInstanceIdArg.longValue()); + api.setWebChromeClient( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (clientInstanceIdArg == null) ? null : clientInstanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1438,7 +1513,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setBackgroundColor", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.setBackgroundColor", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1447,10 +1524,11 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number colorArg = (Number) args.get(1); try { - api.setBackgroundColor((instanceIdArg == null) ? null : instanceIdArg.longValue(), (colorArg == null) ? null : colorArg.longValue()); + api.setBackgroundColor( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (colorArg == null) ? null : colorArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1465,13 +1543,12 @@ public void error(Throwable error) { /** * Flutter API for `WebView`. * - * This class may handle instantiating and adding Dart instances that are - * attached to a native instance or receiving callback methods from an - * overridden native class. + *

This class may handle instantiating and adding Dart instances that are attached to a native + * instance or receiving callback methods from an overridden native class. * - * See https://developer.android.com/reference/android/webkit/WebView. + *

See https://developer.android.com/reference/android/webkit/WebView. * - * Generated class from Pigeon that represents Flutter messages that can be called from Java. + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class WebViewFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -1480,7 +1557,7 @@ public WebViewFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1534,7 +1611,9 @@ public interface WebSettingsHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `WebSettingsHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `WebSettingsHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSettingsHostApi api) { { BasicMessageChannel channel = @@ -1548,10 +1627,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Number webViewInstanceIdArg = (Number) args.get(1); try { - api.create((instanceIdArg == null) ? null : instanceIdArg.longValue(), (webViewInstanceIdArg == null) ? null : webViewInstanceIdArg.longValue()); + api.create( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (webViewInstanceIdArg == null) ? null : webViewInstanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1564,7 +1644,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1573,10 +1655,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean flagArg = (Boolean) args.get(1); try { - api.setDomStorageEnabled((instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); + api.setDomStorageEnabled( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1589,7 +1671,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1598,10 +1682,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean flagArg = (Boolean) args.get(1); try { - api.setJavaScriptCanOpenWindowsAutomatically((instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); + api.setJavaScriptCanOpenWindowsAutomatically( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1614,7 +1698,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1623,10 +1709,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean supportArg = (Boolean) args.get(1); try { - api.setSupportMultipleWindows((instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); + api.setSupportMultipleWindows( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1639,7 +1725,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1648,10 +1736,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean flagArg = (Boolean) args.get(1); try { - api.setJavaScriptEnabled((instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); + api.setJavaScriptEnabled( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1664,7 +1752,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1673,10 +1763,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); String userAgentStringArg = (String) args.get(1); try { - api.setUserAgentString((instanceIdArg == null) ? null : instanceIdArg.longValue(), userAgentStringArg); + api.setUserAgentString( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + userAgentStringArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1689,7 +1780,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1698,10 +1791,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean requireArg = (Boolean) args.get(1); try { - api.setMediaPlaybackRequiresUserGesture((instanceIdArg == null) ? null : instanceIdArg.longValue(), requireArg); + api.setMediaPlaybackRequiresUserGesture( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), requireArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1714,7 +1807,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1723,10 +1818,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean supportArg = (Boolean) args.get(1); try { - api.setSupportZoom((instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); + api.setSupportZoom( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1739,7 +1834,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1748,10 +1845,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean overviewArg = (Boolean) args.get(1); try { - api.setLoadWithOverviewMode((instanceIdArg == null) ? null : instanceIdArg.longValue(), overviewArg); + api.setLoadWithOverviewMode( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), overviewArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1764,7 +1861,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1773,10 +1872,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean useArg = (Boolean) args.get(1); try { - api.setUseWideViewPort((instanceIdArg == null) ? null : instanceIdArg.longValue(), useArg); + api.setUseWideViewPort( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), useArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1789,7 +1888,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1798,10 +1899,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean enabledArg = (Boolean) args.get(1); try { - api.setDisplayZoomControls((instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); + api.setDisplayZoomControls( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1814,7 +1915,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1823,10 +1926,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean enabledArg = (Boolean) args.get(1); try { - api.setBuiltInZoomControls((instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); + api.setBuiltInZoomControls( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1839,7 +1942,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1848,10 +1953,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean enabledArg = (Boolean) args.get(1); try { - api.setAllowFileAccess((instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); + api.setAllowFileAccess( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1873,10 +1978,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Number textZoomArg = (Number) args.get(1); try { - api.setTextZoom((instanceIdArg == null) ? null : instanceIdArg.longValue(), (textZoomArg == null) ? null : textZoomArg.longValue()); + api.setTextZoom( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (textZoomArg == null) ? null : textZoomArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1897,8 +2003,12 @@ public interface JavaScriptChannelHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `JavaScriptChannelHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaScriptChannelHostApi api) { + /** + * Sets up an instance of `JavaScriptChannelHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable JavaScriptChannelHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1911,10 +2021,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaScript Number instanceIdArg = (Number) args.get(0); String channelNameArg = (String) args.get(1); try { - api.create((instanceIdArg == null) ? null : instanceIdArg.longValue(), channelNameArg); + api.create( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), channelNameArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1934,7 +2044,7 @@ public JavaScriptChannelFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1943,10 +2053,14 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void postMessage(@NonNull Long instanceIdArg, @NonNull String messageArg, @NonNull Reply callback) { + + public void postMessage( + @NonNull Long instanceIdArg, @NonNull String messageArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage", + getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, messageArg)), channelReply -> callback.reply(null)); @@ -1957,14 +2071,19 @@ public interface WebViewClientHostApi { void create(@NonNull Long instanceId); - void setSynchronousReturnValueForShouldOverrideUrlLoading(@NonNull Long instanceId, @NonNull Boolean value); + void setSynchronousReturnValueForShouldOverrideUrlLoading( + @NonNull Long instanceId, @NonNull Boolean value); /** The codec used by WebViewClientHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `WebViewClientHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewClientHostApi api) { + /** + * Sets up an instance of `WebViewClientHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable WebViewClientHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1978,8 +2097,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewCli try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1992,7 +2110,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewCli { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2001,10 +2121,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewCli Number instanceIdArg = (Number) args.get(0); Boolean valueArg = (Boolean) args.get(1); try { - api.setSynchronousReturnValueForShouldOverrideUrlLoading((instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); + api.setSynchronousReturnValueForShouldOverrideUrlLoading( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2056,7 +2176,7 @@ public WebViewClientFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2065,47 +2185,97 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return WebViewClientFlutterApiCodec.INSTANCE; } - public void onPageStarted(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Reply callback) { + + public void onPageStarted( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull String urlArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted", + getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), channelReply -> callback.reply(null)); } - public void onPageFinished(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Reply callback) { + + public void onPageFinished( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull String urlArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished", + getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), channelReply -> callback.reply(null)); } - public void onReceivedRequestError(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull WebResourceRequestData requestArg, @NonNull WebResourceErrorData errorArg, @NonNull Reply callback) { + + public void onReceivedRequestError( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull WebResourceRequestData requestArg, + @NonNull WebResourceErrorData errorArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError", + getCodec()); channel.send( - new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg, errorArg)), + new ArrayList( + Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg, errorArg)), channelReply -> callback.reply(null)); } - public void onReceivedError(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull Long errorCodeArg, @NonNull String descriptionArg, @NonNull String failingUrlArg, @NonNull Reply callback) { + + public void onReceivedError( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull Long errorCodeArg, + @NonNull String descriptionArg, + @NonNull String failingUrlArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError", + getCodec()); channel.send( - new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, errorCodeArg, descriptionArg, failingUrlArg)), + new ArrayList( + Arrays.asList( + instanceIdArg, + webViewInstanceIdArg, + errorCodeArg, + descriptionArg, + failingUrlArg)), channelReply -> callback.reply(null)); } - public void requestLoading(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull WebResourceRequestData requestArg, @NonNull Reply callback) { + + public void requestLoading( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull WebResourceRequestData requestArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading", + getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg)), channelReply -> callback.reply(null)); } - public void urlLoading(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Reply callback) { + + public void urlLoading( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull String urlArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading", getCodec()); @@ -2113,12 +2283,21 @@ public void urlLoading(@NonNull Long instanceIdArg, @NonNull Long webViewInstanc new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), channelReply -> callback.reply(null)); } - public void doUpdateVisitedHistory(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Boolean isReloadArg, @NonNull Reply callback) { + + public void doUpdateVisitedHistory( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull String urlArg, + @NonNull Boolean isReloadArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory", + getCodec()); channel.send( - new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg, isReloadArg)), + new ArrayList( + Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg, isReloadArg)), channelReply -> callback.reply(null)); } } @@ -2131,8 +2310,12 @@ public interface DownloadListenerHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `DownloadListenerHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DownloadListenerHostApi api) { + /** + * Sets up an instance of `DownloadListenerHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable DownloadListenerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2146,8 +2329,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DownloadLi try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2167,7 +2349,7 @@ public DownloadListenerFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2176,12 +2358,29 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void onDownloadStart(@NonNull Long instanceIdArg, @NonNull String urlArg, @NonNull String userAgentArg, @NonNull String contentDispositionArg, @NonNull String mimetypeArg, @NonNull Long contentLengthArg, @NonNull Reply callback) { + + public void onDownloadStart( + @NonNull Long instanceIdArg, + @NonNull String urlArg, + @NonNull String userAgentArg, + @NonNull String contentDispositionArg, + @NonNull String mimetypeArg, + @NonNull Long contentLengthArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart", + getCodec()); channel.send( - new ArrayList(Arrays.asList(instanceIdArg, urlArg, userAgentArg, contentDispositionArg, mimetypeArg, contentLengthArg)), + new ArrayList( + Arrays.asList( + instanceIdArg, + urlArg, + userAgentArg, + contentDispositionArg, + mimetypeArg, + contentLengthArg)), channelReply -> callback.reply(null)); } } @@ -2190,14 +2389,19 @@ public interface WebChromeClientHostApi { void create(@NonNull Long instanceId); - void setSynchronousReturnValueForOnShowFileChooser(@NonNull Long instanceId, @NonNull Boolean value); + void setSynchronousReturnValueForOnShowFileChooser( + @NonNull Long instanceId, @NonNull Boolean value); /** The codec used by WebChromeClientHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `WebChromeClientHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeClientHostApi api) { + /** + * Sets up an instance of `WebChromeClientHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeClientHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2211,8 +2415,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeC try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2225,7 +2428,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeC { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2234,10 +2439,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeC Number instanceIdArg = (Number) args.get(0); Boolean valueArg = (Boolean) args.get(1); try { - api.setSynchronousReturnValueForOnShowFileChooser((instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); + api.setSynchronousReturnValueForOnShowFileChooser( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2252,18 +2457,22 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeC /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface FlutterAssetManagerHostApi { - @NonNull + @NonNull List list(@NonNull String path); - @NonNull + @NonNull String getAssetFilePathByName(@NonNull String name); /** The codec used by FlutterAssetManagerHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `FlutterAssetManagerHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable FlutterAssetManagerHostApi api) { + /** + * Sets up an instance of `FlutterAssetManagerHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable FlutterAssetManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2277,8 +2486,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable FlutterAss try { List output = api.list(pathArg); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2291,7 +2499,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable FlutterAss { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2301,8 +2511,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable FlutterAss try { String output = api.getAssetFilePathByName(nameArg); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2322,7 +2531,7 @@ public WebChromeClientFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2331,20 +2540,35 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void onProgressChanged(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull Long progressArg, @NonNull Reply callback) { + + public void onProgressChanged( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull Long progressArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged", + getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, progressArg)), channelReply -> callback.reply(null)); } - public void onShowFileChooser(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull Long paramsInstanceIdArg, @NonNull Reply> callback) { + + public void onShowFileChooser( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull Long paramsInstanceIdArg, + @NonNull Reply> callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser", + getCodec()); channel.send( - new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, paramsInstanceIdArg)), + new ArrayList( + Arrays.asList(instanceIdArg, webViewInstanceIdArg, paramsInstanceIdArg)), channelReply -> { @SuppressWarnings("ConstantConditions") List output = (List) channelReply; @@ -2352,28 +2576,42 @@ public void onShowFileChooser(@NonNull Long instanceIdArg, @NonNull Long webView }); } /** Callback to Dart function `WebChromeClient.onPermissionRequest`. */ - public void onPermissionRequest(@NonNull Long instanceIdArg, @NonNull Long requestInstanceIdArg, @NonNull Reply callback) { + public void onPermissionRequest( + @NonNull Long instanceIdArg, + @NonNull Long requestInstanceIdArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest", + getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, requestInstanceIdArg)), channelReply -> callback.reply(null)); } /** Callback to Dart function `WebChromeClient.onShowCustomView`. */ - public void onShowCustomView(@NonNull Long instanceIdArg, @NonNull Long viewIdentifierArg, @NonNull Long callbackIdentifierArg, @NonNull Reply callback) { + public void onShowCustomView( + @NonNull Long instanceIdArg, + @NonNull Long viewIdentifierArg, + @NonNull Long callbackIdentifierArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView", + getCodec()); channel.send( - new ArrayList(Arrays.asList(instanceIdArg, viewIdentifierArg, callbackIdentifierArg)), + new ArrayList( + Arrays.asList(instanceIdArg, viewIdentifierArg, callbackIdentifierArg)), channelReply -> callback.reply(null)); } /** Callback to Dart function `WebChromeClient.onHideCustomView`. */ public void onHideCustomView(@NonNull Long instanceIdArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onHideCustomView", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebChromeClientFlutterApi.onHideCustomView", + getCodec()); channel.send( new ArrayList(Collections.singletonList(instanceIdArg)), channelReply -> callback.reply(null)); @@ -2390,7 +2628,9 @@ public interface WebStorageHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `WebStorageHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `WebStorageHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorageHostApi api) { { BasicMessageChannel channel = @@ -2405,8 +2645,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorage try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2429,8 +2668,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorage try { api.deleteAllData((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2444,7 +2682,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorage } private static class FileChooserParamsFlutterApiCodec extends StandardMessageCodec { - public static final FileChooserParamsFlutterApiCodec INSTANCE = new FileChooserParamsFlutterApiCodec(); + public static final FileChooserParamsFlutterApiCodec INSTANCE = + new FileChooserParamsFlutterApiCodec(); private FileChooserParamsFlutterApiCodec() {} @@ -2472,9 +2711,10 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { /** * Handles callbacks methods for the native Java FileChooserParams class. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. * - * Generated class from Pigeon that represents Flutter messages that can be called from Java. + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class FileChooserParamsFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2483,7 +2723,7 @@ public FileChooserParamsFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2492,25 +2732,34 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return FileChooserParamsFlutterApiCodec.INSTANCE; } - public void create(@NonNull Long instanceIdArg, @NonNull Boolean isCaptureEnabledArg, @NonNull List acceptTypesArg, @NonNull FileChooserModeEnumData modeArg, @Nullable String filenameHintArg, @NonNull Reply callback) { + + public void create( + @NonNull Long instanceIdArg, + @NonNull Boolean isCaptureEnabledArg, + @NonNull List acceptTypesArg, + @NonNull FileChooserModeEnumData modeArg, + @Nullable String filenameHintArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.FileChooserParamsFlutterApi.create", getCodec()); channel.send( - new ArrayList(Arrays.asList(instanceIdArg, isCaptureEnabledArg, acceptTypesArg, modeArg, filenameHintArg)), + new ArrayList( + Arrays.asList( + instanceIdArg, isCaptureEnabledArg, acceptTypesArg, modeArg, filenameHintArg)), channelReply -> callback.reply(null)); } } /** * Host API for `PermissionRequest`. * - * This class may handle instantiating and adding native object instances that - * are attached to a Dart instance or handle method calls on the associated - * native class or an instance of the class. + *

This class may handle instantiating and adding native object instances that are attached to + * a Dart instance or handle method calls on the associated native class or an instance of the + * class. * - * See https://developer.android.com/reference/android/webkit/PermissionRequest. + *

See https://developer.android.com/reference/android/webkit/PermissionRequest. * - * Generated interface from Pigeon that represents a handler of messages from Flutter. + *

Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface PermissionRequestHostApi { /** Handles Dart method `PermissionRequest.grant`. */ @@ -2522,8 +2771,12 @@ public interface PermissionRequestHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `PermissionRequestHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PermissionRequestHostApi api) { + /** + * Sets up an instance of `PermissionRequestHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable PermissionRequestHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2536,10 +2789,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable Permission Number instanceIdArg = (Number) args.get(0); List resourcesArg = (List) args.get(1); try { - api.grant((instanceIdArg == null) ? null : instanceIdArg.longValue(), resourcesArg); + api.grant( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), resourcesArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2562,8 +2815,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable Permission try { api.deny((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2578,13 +2830,12 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable Permission /** * Flutter API for `PermissionRequest`. * - * This class may handle instantiating and adding Dart instances that are - * attached to a native instance or receiving callback methods from an - * overridden native class. + *

This class may handle instantiating and adding Dart instances that are attached to a native + * instance or receiving callback methods from an overridden native class. * - * See https://developer.android.com/reference/android/webkit/PermissionRequest. + *

See https://developer.android.com/reference/android/webkit/PermissionRequest. * - * Generated class from Pigeon that represents Flutter messages that can be called from Java. + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class PermissionRequestFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2593,7 +2844,7 @@ public PermissionRequestFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2603,7 +2854,10 @@ public interface Reply { return new StandardMessageCodec(); } /** Create a new Dart instance and add it to the `InstanceManager`. */ - public void create(@NonNull Long instanceIdArg, @NonNull List resourcesArg, @NonNull Reply callback) { + public void create( + @NonNull Long instanceIdArg, + @NonNull List resourcesArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.PermissionRequestFlutterApi.create", getCodec()); @@ -2615,13 +2869,14 @@ public void create(@NonNull Long instanceIdArg, @NonNull List resourcesA /** * Host API for `CustomViewCallback`. * - * This class may handle instantiating and adding native object instances that - * are attached to a Dart instance or handle method calls on the associated - * native class or an instance of the class. + *

This class may handle instantiating and adding native object instances that are attached to + * a Dart instance or handle method calls on the associated native class or an instance of the + * class. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. * - * Generated interface from Pigeon that represents a handler of messages from Flutter. + *

Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CustomViewCallbackHostApi { /** Handles Dart method `CustomViewCallback.onCustomViewHidden`. */ @@ -2631,12 +2886,18 @@ public interface CustomViewCallbackHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `CustomViewCallbackHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CustomViewCallbackHostApi api) { + /** + * Sets up an instance of `CustomViewCallbackHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable CustomViewCallbackHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2644,10 +2905,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CustomView ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - api.onCustomViewHidden((identifierArg == null) ? null : identifierArg.longValue()); + api.onCustomViewHidden( + (identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2662,13 +2923,13 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CustomView /** * Flutter API for `CustomViewCallback`. * - * This class may handle instantiating and adding Dart instances that are - * attached to a native instance or receiving callback methods from an - * overridden native class. + *

This class may handle instantiating and adding Dart instances that are attached to a native + * instance or receiving callback methods from an overridden native class. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. * - * Generated class from Pigeon that represents Flutter messages that can be called from Java. + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class CustomViewCallbackFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2677,7 +2938,7 @@ public CustomViewCallbackFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2690,7 +2951,9 @@ public interface Reply { public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.CustomViewCallbackFlutterApi.create", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.CustomViewCallbackFlutterApi.create", + getCodec()); channel.send( new ArrayList(Collections.singletonList(identifierArg)), channelReply -> callback.reply(null)); @@ -2699,13 +2962,12 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { /** * Flutter API for `View`. * - * This class may handle instantiating and adding Dart instances that are - * attached to a native instance or receiving callback methods from an - * overridden native class. + *

This class may handle instantiating and adding Dart instances that are attached to a native + * instance or receiving callback methods from an overridden native class. * - * See https://developer.android.com/reference/android/view/View. + *

See https://developer.android.com/reference/android/view/View. * - * Generated class from Pigeon that represents Flutter messages that can be called from Java. + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class ViewFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2714,7 +2976,7 @@ public ViewFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewFlutterApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewFlutterApiImpl.java index 93bf5521aa43..83719d380a38 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewFlutterApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewFlutterApiImpl.java @@ -7,7 +7,7 @@ package io.flutter.plugins.webviewflutter; -// TODO(bparrishMines): Import native classes +import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; import io.flutter.plugin.common.BinaryMessenger; @@ -20,7 +20,6 @@ * arguments of callbacks methods to a Dart instance. */ public class ViewFlutterApiImpl { - // To ease adding additional methods, this value is added prematurely. @SuppressWarnings({"unused", "FieldCanBeLocal"}) private final BinaryMessenger binaryMessenger; @@ -46,7 +45,6 @@ public ViewFlutterApiImpl( * attached to this one. If `instance` has already been added, this method does nothing. */ public void create(@NonNull View instance, @NonNull ViewFlutterApi.Reply callback) { - if (!instanceManager.containsInstance(instance)) { api.create(instanceManager.addHostCreatedInstance(instance), callback); } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientFlutterApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientFlutterApiImpl.java index fab34fc212d7..28482fd84e19 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientFlutterApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientFlutterApiImpl.java @@ -5,6 +5,7 @@ package io.flutter.plugins.webviewflutter; import android.os.Build; +import android.view.View; import android.webkit.PermissionRequest; import android.webkit.WebChromeClient; import android.webkit.WebView; @@ -90,6 +91,37 @@ public void onPermissionRequest( callback); } + /** + * Sends a message to Dart to call `WebChromeClient.onShowCustomView` on the Dart object + * representing `instance`. + */ + public void onShowCustomView( + @NonNull WebChromeClient instance, + @NonNull View view, + @NonNull WebChromeClient.CustomViewCallback customViewCallback, + @NonNull WebChromeClientFlutterApi.Reply callback) { + new ViewFlutterApiImpl(binaryMessenger, instanceManager).create(view, reply -> {}); + new CustomViewCallbackFlutterApiImpl(binaryMessenger, instanceManager) + .create(customViewCallback, reply -> {}); + + onShowCustomView( + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(instance)), + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(view)), + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(callback)), + callback); + } + + /** + * Sends a message to Dart to call `WebChromeClient.onHideCustomView` on the Dart object + * representing `instance`. + */ + public void onHideCustomView( + @NonNull WebChromeClient instance, @NonNull WebChromeClientFlutterApi.Reply callback) { + super.onHideCustomView( + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(instance)), + callback); + } + private long getIdentifierForClient(WebChromeClient webChromeClient) { final Long identifier = instanceManager.getIdentifierForStrongReference(webChromeClient); if (identifier == null) { diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java index 9b9703739eb9..5c6599b80452 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientHostApiImpl.java @@ -4,24 +4,17 @@ package io.flutter.plugins.webviewflutter; -import android.app.Activity; import android.content.Context; import android.net.Uri; import android.os.Build; import android.os.Message; -import android.view.Gravity; import android.view.View; -import android.view.ViewGroup; -import android.view.Window; -import android.view.WindowInsets; -import android.view.WindowManager; import android.webkit.PermissionRequest; import android.webkit.ValueCallback; import android.webkit.WebChromeClient; import android.webkit.WebResourceRequest; import android.webkit.WebView; import android.webkit.WebViewClient; -import android.widget.FrameLayout; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.RequiresApi; @@ -46,19 +39,14 @@ public class WebChromeClientHostApiImpl implements WebChromeClientHostApi { public static class WebChromeClientImpl extends SecureWebChromeClient { private final WebChromeClientFlutterApiImpl flutterApi; private boolean returnValueForOnShowFileChooser = false; - private View mFullscreenView; - private Context context; /** * Creates a {@link WebChromeClient} that passes arguments of callbacks methods to Dart. * * @param flutterApi handles sending messages to Dart - * @param context the Activity or application context */ - public WebChromeClientImpl( - @NonNull WebChromeClientFlutterApiImpl flutterApi, @NonNull Context context) { + public WebChromeClientImpl(@NonNull WebChromeClientFlutterApiImpl flutterApi) { this.flutterApi = flutterApi; - this.context = context; } @Override @@ -68,64 +56,12 @@ public void onProgressChanged(@NonNull WebView view, int progress) { @Override public void onShowCustomView(View view, WebChromeClient.CustomViewCallback callback) { - if (mFullscreenView != null) { - ((ViewGroup) mFullscreenView.getParent()).removeView(mFullscreenView); - } - if (context instanceof Activity) { - Window window = ((Activity) context).getWindow(); - mFullscreenView = view; - setFullscreenStatus(true, window); - window.addContentView( - mFullscreenView, - new FrameLayout.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - ViewGroup.LayoutParams.MATCH_PARENT, - Gravity.CENTER)); - } + flutterApi.onShowCustomView(this, view, callback, reply -> {}); } @Override public void onHideCustomView() { - if (mFullscreenView == null) { - return; - } - if (context instanceof Activity) { - setFullscreenStatus(false, ((Activity) context).getWindow()); - ((ViewGroup) mFullscreenView.getParent()).removeView(mFullscreenView); - mFullscreenView = null; - } - } - - @SuppressWarnings("deprecation") - void activateFullscreenDeprecated(Boolean fullscreen, Window window) { - View decorView = window.getDecorView(); - if (fullscreen) { - decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN); - - window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); - } else { - decorView.setSystemUiVisibility(View.STATUS_BAR_VISIBLE); - - window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); - } - } - - @RequiresApi(api = Build.VERSION_CODES.R) // >= 30 - void setFullScreenCurrent(Boolean fullscreen, Window window) { - View decorView = window.getDecorView(); - if (fullscreen) { - decorView.getWindowInsetsController().hide(WindowInsets.Type.statusBars()); - } else { - decorView.getWindowInsetsController().show(WindowInsets.Type.statusBars()); - } - } - - void setFullscreenStatus(Boolean fullscreen, Window window) { - if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) { - activateFullscreenDeprecated(fullscreen, window); - } else { - setFullScreenCurrent(fullscreen, window); - } + flutterApi.onHideCustomView(this, reply -> {}); } @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @@ -164,17 +100,6 @@ public void onPermissionRequest(@NonNull PermissionRequest request) { public void setReturnValueForOnShowFileChooser(boolean value) { returnValueForOnShowFileChooser = value; } - - /** - * Returns the fullscreen view - * - * @return View - */ - @Nullable - @VisibleForTesting - public View getmFullscreenView() { - return this.mFullscreenView; - } } /** @@ -271,13 +196,12 @@ public static class WebChromeClientCreator { * Creates a {@link WebChromeClientHostApiImpl.WebChromeClientImpl}. * * @param flutterApi handles sending messages to Dart - * @param context the Activity or application context * @return the created {@link WebChromeClientHostApiImpl.WebChromeClientImpl} */ @NonNull public WebChromeClientImpl createWebChromeClient( - @NonNull WebChromeClientFlutterApiImpl flutterApi, @NonNull Context context) { - return new WebChromeClientImpl(flutterApi, context); + @NonNull WebChromeClientFlutterApiImpl flutterApi) { + return new WebChromeClientImpl(flutterApi); } } @@ -291,27 +215,16 @@ public WebChromeClientImpl createWebChromeClient( public WebChromeClientHostApiImpl( @NonNull InstanceManager instanceManager, @NonNull WebChromeClientCreator webChromeClientCreator, - @NonNull WebChromeClientFlutterApiImpl flutterApi, - @NonNull Context context) { + @NonNull WebChromeClientFlutterApiImpl flutterApi) { this.instanceManager = instanceManager; this.webChromeClientCreator = webChromeClientCreator; this.flutterApi = flutterApi; - this.context = context; - } - - /** - * Sets the context to construct {@link WebChromeClientImpl}s. - * - * @param context the new context - */ - public void setContext(@NonNull Context context) { - this.context = context; } @Override public void create(@NonNull Long instanceId) { final WebChromeClient webChromeClient = - webChromeClientCreator.createWebChromeClient(flutterApi, context); + webChromeClientCreator.createWebChromeClient(flutterApi); instanceManager.addDartCreatedInstance(webChromeClient, instanceId); } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java index 2a4ec7ad4a7d..69ea21fc8875 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java @@ -40,7 +40,6 @@ public class WebViewFlutterPlugin implements FlutterPlugin, ActivityAware { private FlutterPluginBinding pluginBinding; private WebViewHostApiImpl webViewHostApi; private JavaScriptChannelHostApiImpl javaScriptChannelHostApi; - private WebChromeClientHostApiImpl webChromeClientHostApi; /** * Add an instance of this to {@link io.flutter.embedding.engine.plugins.PluginRegistry} to @@ -89,7 +88,7 @@ private void setUp( InstanceManagerHostApi.setup(binaryMessenger, () -> instanceManager.clear()); viewRegistry.registerViewFactory( - "plugins.flutter.io/webview", new FlutterWebViewFactory(instanceManager)); + "plugins.flutter.io/webview", new FlutterViewFactory(instanceManager)); webViewHostApi = new WebViewHostApiImpl( @@ -101,13 +100,6 @@ private void setUp( new JavaScriptChannelFlutterApiImpl(binaryMessenger, instanceManager), new Handler(context.getMainLooper())); - webChromeClientHostApi = - new WebChromeClientHostApiImpl( - instanceManager, - new WebChromeClientHostApiImpl.WebChromeClientCreator(), - new WebChromeClientFlutterApiImpl(binaryMessenger, instanceManager), - context); - JavaObjectHostApi.setup(binaryMessenger, new JavaObjectHostApiImpl(instanceManager)); WebViewHostApi.setup(binaryMessenger, webViewHostApi); JavaScriptChannelHostApi.setup(binaryMessenger, javaScriptChannelHostApi); @@ -117,7 +109,12 @@ private void setUp( instanceManager, new WebViewClientHostApiImpl.WebViewClientCreator(), new WebViewClientFlutterApiImpl(binaryMessenger, instanceManager))); - WebChromeClientHostApi.setup(binaryMessenger, webChromeClientHostApi); + WebChromeClientHostApi.setup( + binaryMessenger, + new WebChromeClientHostApiImpl( + instanceManager, + new WebChromeClientHostApiImpl.WebChromeClientCreator(), + new WebChromeClientFlutterApiImpl(binaryMessenger, instanceManager))); DownloadListenerHostApi.setup( binaryMessenger, new DownloadListenerHostApiImpl( @@ -185,7 +182,6 @@ public void onDetachedFromActivity() { private void updateContext(Context context) { webViewHostApi.setContext(context); javaScriptChannelHostApi.setPlatformThreadHandler(new Handler(context.getMainLooper())); - webChromeClientHostApi.setContext(context); } /** Maintains instances used to communicate with the corresponding objects in Dart. */ diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CustomViewCallbackTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CustomViewCallbackTest.java index 7105cd3185c9..df8341837aa1 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CustomViewCallbackTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CustomViewCallbackTest.java @@ -1,4 +1,3 @@ - // 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. @@ -7,11 +6,11 @@ package io.flutter.plugins.webviewflutter; -// TODO(bparrishMines): Import native classes import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; +import android.webkit.WebChromeClient.CustomViewCallback; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.CustomViewCallbackFlutterApi; import java.util.Objects; @@ -37,17 +36,16 @@ public class CustomViewCallbackTest { @Before public void setUp() { - instanceManager = InstanceManager.open(identifier -> {}); + instanceManager = InstanceManager.create(identifier -> {}); } @After public void tearDown() { - instanceManager.close(); + instanceManager.stopFinalizationListener(); } @Test public void onCustomViewHidden() { - final long instanceIdentifier = 0; instanceManager.addDartCreatedInstance(mockCustomViewCallback, instanceIdentifier); diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java index dc64935a0093..dcfbfc1f81d6 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java @@ -1,4 +1,3 @@ - // 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. @@ -7,11 +6,11 @@ package io.flutter.plugins.webviewflutter; -// TODO(bparrishMines): Import native classes import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; +import android.view.View; import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.ViewFlutterApi; import java.util.Objects; @@ -37,12 +36,12 @@ public class ViewTest { @Before public void setUp() { - instanceManager = InstanceManager.open(identifier -> {}); + instanceManager = InstanceManager.create(identifier -> {}); } @After public void tearDown() { - instanceManager.close(); + instanceManager.stopFinalizationListener(); } @Test diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java index 74279ba59bf1..fb0dd75d2a15 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java @@ -5,7 +5,6 @@ package io.flutter.plugins.webviewflutter; import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; @@ -18,8 +17,10 @@ import android.content.Context; import android.net.Uri; import android.os.Message; +import android.view.View; import android.view.Window; import android.webkit.PermissionRequest; +import android.webkit.WebChromeClient; import android.webkit.WebResourceRequest; import android.webkit.WebView; import android.webkit.WebView.WebViewTransport; @@ -36,6 +37,7 @@ import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; + public class WebChromeClientTest { @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); @@ -64,16 +66,14 @@ public void setUp() { @Override @NonNull public WebChromeClientImpl createWebChromeClient( - @NonNull WebChromeClientFlutterApiImpl flutterApi, @NonNull Context context) { - webChromeClient = super.createWebChromeClient(flutterApi, context); + @NonNull WebChromeClientFlutterApiImpl flutterApi) { + webChromeClient = super.createWebChromeClient(flutterApi); return webChromeClient; } }; hostApiImpl = - new WebChromeClientHostApiImpl( - instanceManager, webChromeClientCreator, mockFlutterApi, mockContext); - hostApiImpl.setContext(mockActivity); + new WebChromeClientHostApiImpl(instanceManager, webChromeClientCreator, mockFlutterApi); hostApiImpl.create(2L); when(mockActivity.getWindow()).thenReturn(mockWindow); @@ -144,14 +144,70 @@ public void onPermissionRequest() { @Test public void onShowCustomView() { - webChromeClient.onShowCustomView(mockWebView, null); - assertNotNull(webChromeClient.getmFullscreenView()); + final View mockView = mock(View.class); + instanceManager.addDartCreatedInstance(mockView, 10); + + final WebChromeClient.CustomViewCallback mockCustomViewCallback = + mock(WebChromeClient.CustomViewCallback.class); + instanceManager.addDartCreatedInstance(mockView, 12); + + webChromeClient.onShowCustomView(mockView, mockCustomViewCallback); + verify(mockFlutterApi) + .onShowCustomView(eq(webChromeClient), eq(mockView), eq(mockCustomViewCallback), any()); } @Test public void onHideCustomView() { - webChromeClient.onShowCustomView(mockWebView, null); webChromeClient.onHideCustomView(); - assertNull(webChromeClient.getmFullscreenView()); + verify(mockFlutterApi).onHideCustomView(eq(webChromeClient), any()); } + + // @Test + // public void onShowCustomView() { + // final WebChromeClientFlutterApiImpl flutterApi = + // new WebChromeClientFlutterApiImpl(mockBinaryMessenger, instanceManager); + // flutterApi.setApi(mockFlutterApi); + // + // final WebChromeClientHostApiImpl.WebChromeClientImpl instance = + // new WebChromeClientHostApiImpl.WebChromeClientImpl(mockBinaryMessenger, instanceManager); + // + // instance.setApi(flutterApi); + // + // final long instanceIdentifier = 0; + // instanceManager.addDartCreatedInstance(instance, instanceIdentifier); + // + // final View mockView = mock(View.class); + // + // final CustomViewCallback mockCallback = mock(CustomViewCallback.class); + // + // instance.onShowCustomView(mockView, mockCallback); + // + // verify(mockFlutterApi) + // .onShowCustomView( + // eq(instanceIdentifier), + // eq(Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(mockView))), + // eq( + // Objects.requireNonNull( + // instanceManager.getIdentifierForStrongReference(mockCallback))), + // any()); + // } + // + // @Test + // public void onHideCustomView() { + // final WebChromeClientFlutterApiImpl flutterApi = + // new WebChromeClientFlutterApiImpl(mockBinaryMessenger, instanceManager); + // flutterApi.setApi(mockFlutterApi); + // + // final WebChromeClientHostApiImpl.WebChromeClientImpl instance = + // new WebChromeClientHostApiImpl.WebChromeClientImpl(mockBinaryMessenger, instanceManager); + // + // instance.setApi(flutterApi); + // + // final long instanceIdentifier = 0; + // instanceManager.addDartCreatedInstance(instance, instanceIdentifier); + // + // instance.onHideCustomView(); + // + // verify(mockFlutterApi).onHideCustomView(eq(instanceIdentifier), any()); + // } } diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart index 5faf679d3f33..8f30b627c16d 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart @@ -20,10 +20,12 @@ enum FileChooserMode { /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN. open, + /// Similar to [open] but allows multiple files to be selected. /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE. openMultiple, + /// Allows picking a nonexistent file and saving it. /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE. @@ -92,7 +94,8 @@ class WebResourceRequestData { isRedirect: result[2] as bool?, hasGesture: result[3]! as bool, method: result[4]! as String, - requestHeaders: (result[5] as Map?)!.cast(), + requestHeaders: + (result[5] as Map?)!.cast(), ); } } @@ -167,8 +170,7 @@ class InstanceManagerHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.InstanceManagerHostApi.clear', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -232,7 +234,8 @@ abstract class JavaObjectFlutterApi { void dispose(int identifier); - static void setup(JavaObjectFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(JavaObjectFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaObjectFlutterApi.dispose', codec, @@ -242,7 +245,7 @@ abstract class JavaObjectFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -294,12 +297,13 @@ class CookieManagerHostApi { } /// Handles Dart method `CookieManager.setCookie`. - Future setCookie(int arg_identifier, String arg_url, String arg_value) async { + Future setCookie( + int arg_identifier, String arg_url, String arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CookieManagerHostApi.setCookie', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_url, arg_value]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_url, arg_value]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -345,12 +349,15 @@ class CookieManagerHostApi { } /// Handles Dart method `CookieManager.setAcceptThirdPartyCookies`. - Future setAcceptThirdPartyCookies(int arg_identifier, int arg_webViewIdentifier, bool arg_accept) async { + Future setAcceptThirdPartyCookies( + int arg_identifier, int arg_webViewIdentifier, bool arg_accept) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies', codec, + 'dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_webViewIdentifier, arg_accept]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_webViewIdentifier, arg_accept]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -383,7 +390,7 @@ class _WebViewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebViewPoint.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -423,12 +430,14 @@ class WebViewHostApi { } } - Future loadData(int arg_instanceId, String arg_data, String? arg_mimeType, String? arg_encoding) async { + Future loadData(int arg_instanceId, String arg_data, + String? arg_mimeType, String? arg_encoding) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.loadData', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_data, arg_mimeType, arg_encoding]) as List?; + final List? replyList = await channel.send( + [arg_instanceId, arg_data, arg_mimeType, arg_encoding]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -445,12 +454,24 @@ class WebViewHostApi { } } - Future loadDataWithBaseUrl(int arg_instanceId, String? arg_baseUrl, String arg_data, String? arg_mimeType, String? arg_encoding, String? arg_historyUrl) async { + Future loadDataWithBaseUrl( + int arg_instanceId, + String? arg_baseUrl, + String arg_data, + String? arg_mimeType, + String? arg_encoding, + String? arg_historyUrl) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_baseUrl, arg_data, arg_mimeType, arg_encoding, arg_historyUrl]) as List?; + final List? replyList = await channel.send([ + arg_instanceId, + arg_baseUrl, + arg_data, + arg_mimeType, + arg_encoding, + arg_historyUrl + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -467,12 +488,14 @@ class WebViewHostApi { } } - Future loadUrl(int arg_instanceId, String arg_url, Map arg_headers) async { + Future loadUrl(int arg_instanceId, String arg_url, + Map arg_headers) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.loadUrl', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_url, arg_headers]) as List?; + await channel.send([arg_instanceId, arg_url, arg_headers]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -489,12 +512,13 @@ class WebViewHostApi { } } - Future postUrl(int arg_instanceId, String arg_url, Uint8List arg_data) async { + Future postUrl( + int arg_instanceId, String arg_url, Uint8List arg_data) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.postUrl', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_url, arg_data]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_url, arg_data]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -658,7 +682,8 @@ class WebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.clearCache', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_includeDiskFiles]) as List?; + await channel.send([arg_instanceId, arg_includeDiskFiles]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -675,12 +700,14 @@ class WebViewHostApi { } } - Future evaluateJavascript(int arg_instanceId, String arg_javascriptString) async { + Future evaluateJavascript( + int arg_instanceId, String arg_javascriptString) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.evaluateJavascript', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_javascriptString]) as List?; + await channel.send([arg_instanceId, arg_javascriptString]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -723,8 +750,8 @@ class WebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.scrollTo', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_x, arg_y]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_x, arg_y]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -745,8 +772,8 @@ class WebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.scrollBy', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_x, arg_y]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_x, arg_y]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -846,7 +873,8 @@ class WebViewHostApi { Future setWebContentsDebuggingEnabled(bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', codec, + 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_enabled]) as List?; @@ -866,12 +894,14 @@ class WebViewHostApi { } } - Future setWebViewClient(int arg_instanceId, int arg_webViewClientInstanceId) async { + Future setWebViewClient( + int arg_instanceId, int arg_webViewClientInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setWebViewClient', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_webViewClientInstanceId]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_webViewClientInstanceId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -888,12 +918,14 @@ class WebViewHostApi { } } - Future addJavaScriptChannel(int arg_instanceId, int arg_javaScriptChannelInstanceId) async { + Future addJavaScriptChannel( + int arg_instanceId, int arg_javaScriptChannelInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_javaScriptChannelInstanceId]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_javaScriptChannelInstanceId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -910,12 +942,14 @@ class WebViewHostApi { } } - Future removeJavaScriptChannel(int arg_instanceId, int arg_javaScriptChannelInstanceId) async { + Future removeJavaScriptChannel( + int arg_instanceId, int arg_javaScriptChannelInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_javaScriptChannelInstanceId]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_javaScriptChannelInstanceId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -932,12 +966,14 @@ class WebViewHostApi { } } - Future setDownloadListener(int arg_instanceId, int? arg_listenerInstanceId) async { + Future setDownloadListener( + int arg_instanceId, int? arg_listenerInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setDownloadListener', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_listenerInstanceId]) as List?; + await channel.send([arg_instanceId, arg_listenerInstanceId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -954,12 +990,14 @@ class WebViewHostApi { } } - Future setWebChromeClient(int arg_instanceId, int? arg_clientInstanceId) async { + Future setWebChromeClient( + int arg_instanceId, int? arg_clientInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setWebChromeClient', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_clientInstanceId]) as List?; + await channel.send([arg_instanceId, arg_clientInstanceId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -980,8 +1018,8 @@ class WebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setBackgroundColor', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_color]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_color]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1012,7 +1050,8 @@ abstract class WebViewFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int identifier); - static void setup(WebViewFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(WebViewFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewFlutterApi.create', codec, @@ -1022,7 +1061,7 @@ abstract class WebViewFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebViewFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1050,7 +1089,8 @@ class WebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.create', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_webViewInstanceId]) as List?; + await channel.send([arg_instanceId, arg_webViewInstanceId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1071,8 +1111,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_flag]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_flag]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1089,12 +1129,14 @@ class WebSettingsHostApi { } } - Future setJavaScriptCanOpenWindowsAutomatically(int arg_instanceId, bool arg_flag) async { + Future setJavaScriptCanOpenWindowsAutomatically( + int arg_instanceId, bool arg_flag) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_flag]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_flag]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1111,12 +1153,14 @@ class WebSettingsHostApi { } } - Future setSupportMultipleWindows(int arg_instanceId, bool arg_support) async { + Future setSupportMultipleWindows( + int arg_instanceId, bool arg_support) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_support]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_support]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1137,8 +1181,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_flag]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_flag]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1155,12 +1199,13 @@ class WebSettingsHostApi { } } - Future setUserAgentString(int arg_instanceId, String? arg_userAgentString) async { + Future setUserAgentString( + int arg_instanceId, String? arg_userAgentString) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_userAgentString]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_userAgentString]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1177,12 +1222,14 @@ class WebSettingsHostApi { } } - Future setMediaPlaybackRequiresUserGesture(int arg_instanceId, bool arg_require) async { + Future setMediaPlaybackRequiresUserGesture( + int arg_instanceId, bool arg_require) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_require]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_require]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1203,8 +1250,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_support]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_support]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1221,12 +1268,13 @@ class WebSettingsHostApi { } } - Future setLoadWithOverviewMode(int arg_instanceId, bool arg_overview) async { + Future setLoadWithOverviewMode( + int arg_instanceId, bool arg_overview) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_overview]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_overview]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1247,8 +1295,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_use]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_use]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1265,12 +1313,13 @@ class WebSettingsHostApi { } } - Future setDisplayZoomControls(int arg_instanceId, bool arg_enabled) async { + Future setDisplayZoomControls( + int arg_instanceId, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_enabled]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1287,12 +1336,13 @@ class WebSettingsHostApi { } } - Future setBuiltInZoomControls(int arg_instanceId, bool arg_enabled) async { + Future setBuiltInZoomControls( + int arg_instanceId, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_enabled]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1313,8 +1363,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_enabled]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1335,8 +1385,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setTextZoom', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_textZoom]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_textZoom]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1368,8 +1418,8 @@ class JavaScriptChannelHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_channelName]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_channelName]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1392,7 +1442,8 @@ abstract class JavaScriptChannelFlutterApi { void postMessage(int instanceId, String message); - static void setup(JavaScriptChannelFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(JavaScriptChannelFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage', codec, @@ -1402,7 +1453,7 @@ abstract class JavaScriptChannelFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage was null.'); + 'Argument for dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1450,12 +1501,14 @@ class WebViewClientHostApi { } } - Future setSynchronousReturnValueForShouldOverrideUrlLoading(int arg_instanceId, bool arg_value) async { + Future setSynchronousReturnValueForShouldOverrideUrlLoading( + int arg_instanceId, bool arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', codec, + 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_value]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_value]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1491,9 +1544,9 @@ class _WebViewClientFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebResourceErrorData.decode(readValue(buffer)!); - case 129: + case 129: return WebResourceRequestData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1508,17 +1561,22 @@ abstract class WebViewClientFlutterApi { void onPageFinished(int instanceId, int webViewInstanceId, String url); - void onReceivedRequestError(int instanceId, int webViewInstanceId, WebResourceRequestData request, WebResourceErrorData error); + void onReceivedRequestError(int instanceId, int webViewInstanceId, + WebResourceRequestData request, WebResourceErrorData error); - void onReceivedError(int instanceId, int webViewInstanceId, int errorCode, String description, String failingUrl); + void onReceivedError(int instanceId, int webViewInstanceId, int errorCode, + String description, String failingUrl); - void requestLoading(int instanceId, int webViewInstanceId, WebResourceRequestData request); + void requestLoading( + int instanceId, int webViewInstanceId, WebResourceRequestData request); void urlLoading(int instanceId, int webViewInstanceId, String url); - void doUpdateVisitedHistory(int instanceId, int webViewInstanceId, String url, bool isReload); + void doUpdateVisitedHistory( + int instanceId, int webViewInstanceId, String url, bool isReload); - static void setup(WebViewClientFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(WebViewClientFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted', codec, @@ -1528,7 +1586,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1553,7 +1611,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1571,14 +1629,15 @@ abstract class WebViewClientFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError', codec, + 'dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1586,13 +1645,16 @@ abstract class WebViewClientFlutterApi { final int? arg_webViewInstanceId = (args[1] as int?); assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null int.'); - final WebResourceRequestData? arg_request = (args[2] as WebResourceRequestData?); + final WebResourceRequestData? arg_request = + (args[2] as WebResourceRequestData?); assert(arg_request != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null WebResourceRequestData.'); - final WebResourceErrorData? arg_error = (args[3] as WebResourceErrorData?); + final WebResourceErrorData? arg_error = + (args[3] as WebResourceErrorData?); assert(arg_error != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null WebResourceErrorData.'); - api.onReceivedRequestError(arg_instanceId!, arg_webViewInstanceId!, arg_request!, arg_error!); + api.onReceivedRequestError(arg_instanceId!, arg_webViewInstanceId!, + arg_request!, arg_error!); return; }); } @@ -1606,7 +1668,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1623,7 +1685,8 @@ abstract class WebViewClientFlutterApi { final String? arg_failingUrl = (args[4] as String?); assert(arg_failingUrl != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null String.'); - api.onReceivedError(arg_instanceId!, arg_webViewInstanceId!, arg_errorCode!, arg_description!, arg_failingUrl!); + api.onReceivedError(arg_instanceId!, arg_webViewInstanceId!, + arg_errorCode!, arg_description!, arg_failingUrl!); return; }); } @@ -1637,7 +1700,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1645,10 +1708,12 @@ abstract class WebViewClientFlutterApi { final int? arg_webViewInstanceId = (args[1] as int?); assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null, expected non-null int.'); - final WebResourceRequestData? arg_request = (args[2] as WebResourceRequestData?); + final WebResourceRequestData? arg_request = + (args[2] as WebResourceRequestData?); assert(arg_request != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null, expected non-null WebResourceRequestData.'); - api.requestLoading(arg_instanceId!, arg_webViewInstanceId!, arg_request!); + api.requestLoading( + arg_instanceId!, arg_webViewInstanceId!, arg_request!); return; }); } @@ -1662,7 +1727,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1680,14 +1745,15 @@ abstract class WebViewClientFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory', codec, + 'dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1701,7 +1767,8 @@ abstract class WebViewClientFlutterApi { final bool? arg_isReload = (args[3] as bool?); assert(arg_isReload != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null, expected non-null bool.'); - api.doUpdateVisitedHistory(arg_instanceId!, arg_webViewInstanceId!, arg_url!, arg_isReload!); + api.doUpdateVisitedHistory( + arg_instanceId!, arg_webViewInstanceId!, arg_url!, arg_isReload!); return; }); } @@ -1745,19 +1812,22 @@ class DownloadListenerHostApi { abstract class DownloadListenerFlutterApi { static const MessageCodec codec = StandardMessageCodec(); - void onDownloadStart(int instanceId, String url, String userAgent, String contentDisposition, String mimetype, int contentLength); + void onDownloadStart(int instanceId, String url, String userAgent, + String contentDisposition, String mimetype, int contentLength); - static void setup(DownloadListenerFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(DownloadListenerFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart', codec, + 'dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null.'); + 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1777,7 +1847,8 @@ abstract class DownloadListenerFlutterApi { final int? arg_contentLength = (args[5] as int?); assert(arg_contentLength != null, 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null int.'); - api.onDownloadStart(arg_instanceId!, arg_url!, arg_userAgent!, arg_contentDisposition!, arg_mimetype!, arg_contentLength!); + api.onDownloadStart(arg_instanceId!, arg_url!, arg_userAgent!, + arg_contentDisposition!, arg_mimetype!, arg_contentLength!); return; }); } @@ -1817,12 +1888,14 @@ class WebChromeClientHostApi { } } - Future setSynchronousReturnValueForOnShowFileChooser(int arg_instanceId, bool arg_value) async { + Future setSynchronousReturnValueForOnShowFileChooser( + int arg_instanceId, bool arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', codec, + 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_value]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_value]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1879,7 +1952,8 @@ class FlutterAssetManagerHostApi { Future getAssetFilePathByName(String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', codec, + 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_name]) as List?; @@ -1910,28 +1984,32 @@ abstract class WebChromeClientFlutterApi { void onProgressChanged(int instanceId, int webViewInstanceId, int progress); - Future> onShowFileChooser(int instanceId, int webViewInstanceId, int paramsInstanceId); + Future> onShowFileChooser( + int instanceId, int webViewInstanceId, int paramsInstanceId); /// Callback to Dart function `WebChromeClient.onPermissionRequest`. void onPermissionRequest(int instanceId, int requestInstanceId); /// Callback to Dart function `WebChromeClient.onShowCustomView`. - void onShowCustomView(int instanceId, int viewIdentifier, int callbackIdentifier); + void onShowCustomView( + int instanceId, int viewIdentifier, int callbackIdentifier); /// Callback to Dart function `WebChromeClient.onHideCustomView`. void onHideCustomView(int instanceId); - static void setup(WebChromeClientFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(WebChromeClientFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged', codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1942,21 +2020,23 @@ abstract class WebChromeClientFlutterApi { final int? arg_progress = (args[2] as int?); assert(arg_progress != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null, expected non-null int.'); - api.onProgressChanged(arg_instanceId!, arg_webViewInstanceId!, arg_progress!); + api.onProgressChanged( + arg_instanceId!, arg_webViewInstanceId!, arg_progress!); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser', codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1967,21 +2047,23 @@ abstract class WebChromeClientFlutterApi { final int? arg_paramsInstanceId = (args[2] as int?); assert(arg_paramsInstanceId != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null, expected non-null int.'); - final List output = await api.onShowFileChooser(arg_instanceId!, arg_webViewInstanceId!, arg_paramsInstanceId!); + final List output = await api.onShowFileChooser( + arg_instanceId!, arg_webViewInstanceId!, arg_paramsInstanceId!); return output; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest', codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1996,14 +2078,15 @@ abstract class WebChromeClientFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView', codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -2014,21 +2097,23 @@ abstract class WebChromeClientFlutterApi { final int? arg_callbackIdentifier = (args[2] as int?); assert(arg_callbackIdentifier != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView was null, expected non-null int.'); - api.onShowCustomView(arg_instanceId!, arg_viewIdentifier!, arg_callbackIdentifier!); + api.onShowCustomView( + arg_instanceId!, arg_viewIdentifier!, arg_callbackIdentifier!); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onHideCustomView', codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onHideCustomView', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onHideCustomView was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onHideCustomView was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -2111,7 +2196,7 @@ class _FileChooserParamsFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return FileChooserModeEnumData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -2123,11 +2208,14 @@ class _FileChooserParamsFlutterApiCodec extends StandardMessageCodec { /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. abstract class FileChooserParamsFlutterApi { - static const MessageCodec codec = _FileChooserParamsFlutterApiCodec(); + static const MessageCodec codec = + _FileChooserParamsFlutterApiCodec(); - void create(int instanceId, bool isCaptureEnabled, List acceptTypes, FileChooserModeEnumData mode, String? filenameHint); + void create(int instanceId, bool isCaptureEnabled, List acceptTypes, + FileChooserModeEnumData mode, String? filenameHint); - static void setup(FileChooserParamsFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(FileChooserParamsFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FileChooserParamsFlutterApi.create', codec, @@ -2137,7 +2225,7 @@ abstract class FileChooserParamsFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -2145,14 +2233,17 @@ abstract class FileChooserParamsFlutterApi { final bool? arg_isCaptureEnabled = (args[1] as bool?); assert(arg_isCaptureEnabled != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null bool.'); - final List? arg_acceptTypes = (args[2] as List?)?.cast(); + final List? arg_acceptTypes = + (args[2] as List?)?.cast(); assert(arg_acceptTypes != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null List.'); - final FileChooserModeEnumData? arg_mode = (args[3] as FileChooserModeEnumData?); + final FileChooserModeEnumData? arg_mode = + (args[3] as FileChooserModeEnumData?); assert(arg_mode != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null FileChooserModeEnumData.'); final String? arg_filenameHint = (args[4] as String?); - api.create(arg_instanceId!, arg_isCaptureEnabled!, arg_acceptTypes!, arg_mode!, arg_filenameHint); + api.create(arg_instanceId!, arg_isCaptureEnabled!, arg_acceptTypes!, + arg_mode!, arg_filenameHint); return; }); } @@ -2182,8 +2273,8 @@ class PermissionRequestHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PermissionRequestHostApi.grant', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_resources]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_resources]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2237,7 +2328,8 @@ abstract class PermissionRequestFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int instanceId, List resources); - static void setup(PermissionRequestFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(PermissionRequestFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PermissionRequestFlutterApi.create', codec, @@ -2247,12 +2339,13 @@ abstract class PermissionRequestFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PermissionRequestFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.PermissionRequestFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.PermissionRequestFlutterApi.create was null, expected non-null int.'); - final List? arg_resources = (args[1] as List?)?.cast(); + final List? arg_resources = + (args[1] as List?)?.cast(); assert(arg_resources != null, 'Argument for dev.flutter.pigeon.PermissionRequestFlutterApi.create was null, expected non-null List.'); api.create(arg_instanceId!, arg_resources!); @@ -2283,7 +2376,8 @@ class CustomViewCallbackHostApi { /// Handles Dart method `CustomViewCallback.onCustomViewHidden`. Future onCustomViewHidden(int arg_identifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden', codec, + 'dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_identifier]) as List?; @@ -2317,7 +2411,8 @@ abstract class CustomViewCallbackFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int identifier); - static void setup(CustomViewCallbackFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(CustomViewCallbackFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CustomViewCallbackFlutterApi.create', codec, @@ -2327,7 +2422,7 @@ abstract class CustomViewCallbackFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CustomViewCallbackFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.CustomViewCallbackFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2363,7 +2458,7 @@ abstract class ViewFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ViewFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.ViewFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, diff --git a/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart index 0306fbffb5e5..dc4e4bce860c 100644 --- a/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart +++ b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart @@ -15,7 +15,8 @@ import 'package:webview_flutter_android/src/android_webview.g.dart'; /// Host API for managing the native `InstanceManager`. abstract class TestInstanceManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Clear the native `InstanceManager`. @@ -23,15 +24,19 @@ abstract class TestInstanceManagerHostApi { /// This is typically only used after a hot restart. void clear(); - static void setup(TestInstanceManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestInstanceManagerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.InstanceManagerHostApi.clear', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { // ignore message api.clear(); return []; @@ -47,22 +52,27 @@ abstract class TestInstanceManagerHostApi { /// /// See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. abstract class TestJavaObjectHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void dispose(int identifier); - static void setup(TestJavaObjectHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestJavaObjectHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaObjectHostApi.dispose', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -81,7 +91,8 @@ abstract class TestJavaObjectHostApi { /// are attached to a Dart instance or handle method calls on the associated /// native class or an instance of the class. abstract class TestCookieManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Handles attaching `CookieManager.instance` to a native instance. @@ -94,19 +105,24 @@ abstract class TestCookieManagerHostApi { Future removeAllCookies(int identifier); /// Handles Dart method `CookieManager.setAcceptThirdPartyCookies`. - void setAcceptThirdPartyCookies(int identifier, int webViewIdentifier, bool accept); + void setAcceptThirdPartyCookies( + int identifier, int webViewIdentifier, bool accept); - static void setup(TestCookieManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestCookieManagerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CookieManagerHostApi.attachInstance', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CookieManagerHostApi.attachInstance was null.'); + 'Argument for dev.flutter.pigeon.CookieManagerHostApi.attachInstance was null.'); final List args = (message as List?)!; final int? arg_instanceIdentifier = (args[0] as int?); assert(arg_instanceIdentifier != null, @@ -121,11 +137,14 @@ abstract class TestCookieManagerHostApi { 'dev.flutter.pigeon.CookieManagerHostApi.setCookie', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setCookie was null.'); + 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setCookie was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -146,11 +165,14 @@ abstract class TestCookieManagerHostApi { 'dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies was null.'); + 'Argument for dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -162,14 +184,18 @@ abstract class TestCookieManagerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies', codec, + 'dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies was null.'); + 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -180,7 +206,8 @@ abstract class TestCookieManagerHostApi { final bool? arg_accept = (args[2] as bool?); assert(arg_accept != null, 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies was null, expected non-null bool.'); - api.setAcceptThirdPartyCookies(arg_identifier!, arg_webViewIdentifier!, arg_accept!); + api.setAcceptThirdPartyCookies( + arg_identifier!, arg_webViewIdentifier!, arg_accept!); return []; }); } @@ -203,7 +230,7 @@ class _TestWebViewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebViewPoint.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -212,14 +239,17 @@ class _TestWebViewHostApiCodec extends StandardMessageCodec { } abstract class TestWebViewHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestWebViewHostApiCodec(); void create(int instanceId); - void loadData(int instanceId, String data, String? mimeType, String? encoding); + void loadData( + int instanceId, String data, String? mimeType, String? encoding); - void loadDataWithBaseUrl(int instanceId, String? baseUrl, String data, String? mimeType, String? encoding, String? historyUrl); + void loadDataWithBaseUrl(int instanceId, String? baseUrl, String data, + String? mimeType, String? encoding, String? historyUrl); void loadUrl(int instanceId, String url, Map headers); @@ -267,17 +297,21 @@ abstract class TestWebViewHostApi { void setBackgroundColor(int instanceId, int color); - static void setup(TestWebViewHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebViewHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -292,11 +326,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.loadData', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -316,11 +353,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -332,7 +372,8 @@ abstract class TestWebViewHostApi { final String? arg_mimeType = (args[3] as String?); final String? arg_encoding = (args[4] as String?); final String? arg_historyUrl = (args[5] as String?); - api.loadDataWithBaseUrl(arg_instanceId!, arg_baseUrl, arg_data!, arg_mimeType, arg_encoding, arg_historyUrl); + api.loadDataWithBaseUrl(arg_instanceId!, arg_baseUrl, arg_data!, + arg_mimeType, arg_encoding, arg_historyUrl); return []; }); } @@ -342,11 +383,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.loadUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -354,7 +398,8 @@ abstract class TestWebViewHostApi { final String? arg_url = (args[1] as String?); assert(arg_url != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null String.'); - final Map? arg_headers = (args[2] as Map?)?.cast(); + final Map? arg_headers = + (args[2] as Map?)?.cast(); assert(arg_headers != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null Map.'); api.loadUrl(arg_instanceId!, arg_url!, arg_headers!); @@ -367,11 +412,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.postUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -392,11 +440,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -411,11 +462,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.canGoBack', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoBack was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -430,11 +484,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.canGoForward', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoForward was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -449,11 +506,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.goBack', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.goBack was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.goBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -468,11 +528,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.goForward', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.goForward was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.goForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -487,11 +550,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.reload', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.reload was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.reload was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -506,11 +572,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.clearCache', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -528,11 +597,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.evaluateJavascript', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -540,7 +612,8 @@ abstract class TestWebViewHostApi { final String? arg_javascriptString = (args[1] as String?); assert(arg_javascriptString != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null, expected non-null String.'); - final String? output = await api.evaluateJavascript(arg_instanceId!, arg_javascriptString!); + final String? output = await api.evaluateJavascript( + arg_instanceId!, arg_javascriptString!); return [output]; }); } @@ -550,11 +623,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getTitle', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getTitle was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getTitle was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -569,11 +645,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.scrollTo', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -594,11 +673,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.scrollBy', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -619,11 +701,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getScrollX', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollX was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollX was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -638,11 +723,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getScrollY', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollY was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollY was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -657,11 +745,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getScrollPosition', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollPosition was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollPosition was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -673,14 +764,18 @@ abstract class TestWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', codec, + 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled was null.'); final List args = (message as List?)!; final bool? arg_enabled = (args[0] as bool?); assert(arg_enabled != null, @@ -695,11 +790,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setWebViewClient', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -717,11 +815,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -729,7 +830,8 @@ abstract class TestWebViewHostApi { final int? arg_javaScriptChannelInstanceId = (args[1] as int?); assert(arg_javaScriptChannelInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null, expected non-null int.'); - api.addJavaScriptChannel(arg_instanceId!, arg_javaScriptChannelInstanceId!); + api.addJavaScriptChannel( + arg_instanceId!, arg_javaScriptChannelInstanceId!); return []; }); } @@ -739,11 +841,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -751,7 +856,8 @@ abstract class TestWebViewHostApi { final int? arg_javaScriptChannelInstanceId = (args[1] as int?); assert(arg_javaScriptChannelInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null, expected non-null int.'); - api.removeJavaScriptChannel(arg_instanceId!, arg_javaScriptChannelInstanceId!); + api.removeJavaScriptChannel( + arg_instanceId!, arg_javaScriptChannelInstanceId!); return []; }); } @@ -761,11 +867,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setDownloadListener', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -781,11 +890,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setWebChromeClient', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -801,11 +913,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setBackgroundColor', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -822,7 +937,8 @@ abstract class TestWebViewHostApi { } abstract class TestWebSettingsHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId, int webViewInstanceId); @@ -853,17 +969,21 @@ abstract class TestWebSettingsHostApi { void setTextZoom(int instanceId, int textZoom); - static void setup(TestWebSettingsHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebSettingsHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -881,11 +1001,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -900,14 +1023,18 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -915,21 +1042,26 @@ abstract class TestWebSettingsHostApi { final bool? arg_flag = (args[1] as bool?); assert(arg_flag != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null, expected non-null bool.'); - api.setJavaScriptCanOpenWindowsAutomatically(arg_instanceId!, arg_flag!); + api.setJavaScriptCanOpenWindowsAutomatically( + arg_instanceId!, arg_flag!); return []; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -947,11 +1079,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -969,11 +1104,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -986,14 +1124,18 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1001,7 +1143,8 @@ abstract class TestWebSettingsHostApi { final bool? arg_require = (args[1] as bool?); assert(arg_require != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null, expected non-null bool.'); - api.setMediaPlaybackRequiresUserGesture(arg_instanceId!, arg_require!); + api.setMediaPlaybackRequiresUserGesture( + arg_instanceId!, arg_require!); return []; }); } @@ -1011,11 +1154,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1030,14 +1176,18 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1055,11 +1205,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1077,11 +1230,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1099,11 +1255,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1121,11 +1280,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1143,11 +1305,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setTextZoom', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setTextZoom was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setTextZoom was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1164,22 +1329,27 @@ abstract class TestWebSettingsHostApi { } abstract class TestJavaScriptChannelHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId, String channelName); - static void setup(TestJavaScriptChannelHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestJavaScriptChannelHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1196,24 +1366,30 @@ abstract class TestJavaScriptChannelHostApi { } abstract class TestWebViewClientHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - void setSynchronousReturnValueForShouldOverrideUrlLoading(int instanceId, bool value); + void setSynchronousReturnValueForShouldOverrideUrlLoading( + int instanceId, bool value); - static void setup(TestWebViewClientHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebViewClientHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewClientHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1225,14 +1401,18 @@ abstract class TestWebViewClientHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', codec, + 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1240,7 +1420,8 @@ abstract class TestWebViewClientHostApi { final bool? arg_value = (args[1] as bool?); assert(arg_value != null, 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null, expected non-null bool.'); - api.setSynchronousReturnValueForShouldOverrideUrlLoading(arg_instanceId!, arg_value!); + api.setSynchronousReturnValueForShouldOverrideUrlLoading( + arg_instanceId!, arg_value!); return []; }); } @@ -1249,22 +1430,27 @@ abstract class TestWebViewClientHostApi { } abstract class TestDownloadListenerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - static void setup(TestDownloadListenerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestDownloadListenerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.DownloadListenerHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.DownloadListenerHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.DownloadListenerHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1278,24 +1464,30 @@ abstract class TestDownloadListenerHostApi { } abstract class TestWebChromeClientHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - void setSynchronousReturnValueForOnShowFileChooser(int instanceId, bool value); + void setSynchronousReturnValueForOnShowFileChooser( + int instanceId, bool value); - static void setup(TestWebChromeClientHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebChromeClientHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebChromeClientHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1307,14 +1499,18 @@ abstract class TestWebChromeClientHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', codec, + 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1322,7 +1518,8 @@ abstract class TestWebChromeClientHostApi { final bool? arg_value = (args[1] as bool?); assert(arg_value != null, 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null, expected non-null bool.'); - api.setSynchronousReturnValueForOnShowFileChooser(arg_instanceId!, arg_value!); + api.setSynchronousReturnValueForOnShowFileChooser( + arg_instanceId!, arg_value!); return []; }); } @@ -1331,24 +1528,29 @@ abstract class TestWebChromeClientHostApi { } abstract class TestAssetManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); List list(String path); String getAssetFilePathByName(String name); - static void setup(TestAssetManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestAssetManagerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FlutterAssetManagerHostApi.list', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.list was null.'); + 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.list was null.'); final List args = (message as List?)!; final String? arg_path = (args[0] as String?); assert(arg_path != null, @@ -1360,14 +1562,18 @@ abstract class TestAssetManagerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', codec, + 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName was null.'); + 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName was null.'); final List args = (message as List?)!; final String? arg_name = (args[0] as String?); assert(arg_name != null, @@ -1381,24 +1587,29 @@ abstract class TestAssetManagerHostApi { } abstract class TestWebStorageHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); void deleteAllData(int instanceId); - static void setup(TestWebStorageHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebStorageHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebStorageHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebStorageHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebStorageHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1413,11 +1624,14 @@ abstract class TestWebStorageHostApi { 'dev.flutter.pigeon.WebStorageHostApi.deleteAllData', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebStorageHostApi.deleteAllData was null.'); + 'Argument for dev.flutter.pigeon.WebStorageHostApi.deleteAllData was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1438,7 +1652,8 @@ abstract class TestWebStorageHostApi { /// /// See https://developer.android.com/reference/android/webkit/PermissionRequest. abstract class TestPermissionRequestHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Handles Dart method `PermissionRequest.grant`. @@ -1447,22 +1662,27 @@ abstract class TestPermissionRequestHostApi { /// Handles Dart method `PermissionRequest.deny`. void deny(int instanceId); - static void setup(TestPermissionRequestHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestPermissionRequestHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PermissionRequestHostApi.grant', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null.'); + 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null, expected non-null int.'); - final List? arg_resources = (args[1] as List?)?.cast(); + final List? arg_resources = + (args[1] as List?)?.cast(); assert(arg_resources != null, 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null, expected non-null List.'); api.grant(arg_instanceId!, arg_resources!); @@ -1475,11 +1695,14 @@ abstract class TestPermissionRequestHostApi { 'dev.flutter.pigeon.PermissionRequestHostApi.deny', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.deny was null.'); + 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.deny was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1500,23 +1723,29 @@ abstract class TestPermissionRequestHostApi { /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. abstract class TestCustomViewCallbackHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Handles Dart method `CustomViewCallback.onCustomViewHidden`. void onCustomViewHidden(int identifier); - static void setup(TestCustomViewCallbackHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestCustomViewCallbackHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden', codec, + 'dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden was null.'); + 'Argument for dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, From d547039683ea6d0c7c247641686946484fecec3b Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 31 May 2023 13:09:32 -0400 Subject: [PATCH 12/35] fix java side --- .../webviewflutter/FlutterViewFactory.java | 26 ++++++++-- .../WebChromeClientFlutterApiImpl.java | 2 +- .../webviewflutter/WebChromeClientTest.java | 52 ------------------- 3 files changed, 22 insertions(+), 58 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterViewFactory.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterViewFactory.java index 985149329ad9..70016d8e3695 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterViewFactory.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterViewFactory.java @@ -5,6 +5,8 @@ package io.flutter.plugins.webviewflutter; import android.content.Context; +import android.view.View; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import io.flutter.plugin.common.StandardMessageCodec; @@ -24,13 +26,27 @@ class FlutterViewFactory extends PlatformViewFactory { public PlatformView create(Context context, int viewId, @Nullable Object args) { final Integer identifier = (Integer) args; if (identifier == null) { - throw new IllegalStateException("An identifier is required to retrieve WebView instance."); + throw new IllegalStateException("An identifier is required to retrieve a View instance."); } - final PlatformView view = instanceManager.getInstance(identifier); - if (view == null) { - throw new IllegalStateException("Unable to find View instance: " + args); + final Object instance = instanceManager.getInstance(identifier); + + if (instance instanceof PlatformView) { + return (PlatformView) instance; + } else if (instance instanceof View) { + return new PlatformView() { + @Override + public View getView() { + return (View) instance; + } + + @Override + public void dispose() { + + } + }; } - return view; + + throw new IllegalStateException(String.format("Unable to find a PlatformView or View instance: args: %s, instance: %s", args, instance)); } } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientFlutterApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientFlutterApiImpl.java index 28482fd84e19..f56f87b49b1a 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientFlutterApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebChromeClientFlutterApiImpl.java @@ -107,7 +107,7 @@ public void onShowCustomView( onShowCustomView( Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(instance)), Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(view)), - Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(callback)), + Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(customViewCallback)), callback); } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java index fb0dd75d2a15..5109bc4fda0a 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java @@ -14,7 +14,6 @@ import static org.mockito.Mockito.when; import android.app.Activity; -import android.content.Context; import android.net.Uri; import android.os.Message; import android.view.View; @@ -47,8 +46,6 @@ public class WebChromeClientTest { @Mock public WebViewClient mockWebViewClient; - @Mock public Context mockContext; - @Mock public Activity mockActivity; @Mock public Window mockWindow; @@ -161,53 +158,4 @@ public void onHideCustomView() { webChromeClient.onHideCustomView(); verify(mockFlutterApi).onHideCustomView(eq(webChromeClient), any()); } - - // @Test - // public void onShowCustomView() { - // final WebChromeClientFlutterApiImpl flutterApi = - // new WebChromeClientFlutterApiImpl(mockBinaryMessenger, instanceManager); - // flutterApi.setApi(mockFlutterApi); - // - // final WebChromeClientHostApiImpl.WebChromeClientImpl instance = - // new WebChromeClientHostApiImpl.WebChromeClientImpl(mockBinaryMessenger, instanceManager); - // - // instance.setApi(flutterApi); - // - // final long instanceIdentifier = 0; - // instanceManager.addDartCreatedInstance(instance, instanceIdentifier); - // - // final View mockView = mock(View.class); - // - // final CustomViewCallback mockCallback = mock(CustomViewCallback.class); - // - // instance.onShowCustomView(mockView, mockCallback); - // - // verify(mockFlutterApi) - // .onShowCustomView( - // eq(instanceIdentifier), - // eq(Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(mockView))), - // eq( - // Objects.requireNonNull( - // instanceManager.getIdentifierForStrongReference(mockCallback))), - // any()); - // } - // - // @Test - // public void onHideCustomView() { - // final WebChromeClientFlutterApiImpl flutterApi = - // new WebChromeClientFlutterApiImpl(mockBinaryMessenger, instanceManager); - // flutterApi.setApi(mockFlutterApi); - // - // final WebChromeClientHostApiImpl.WebChromeClientImpl instance = - // new WebChromeClientHostApiImpl.WebChromeClientImpl(mockBinaryMessenger, instanceManager); - // - // instance.setApi(flutterApi); - // - // final long instanceIdentifier = 0; - // instanceManager.addDartCreatedInstance(instance, instanceIdentifier); - // - // instance.onHideCustomView(); - // - // verify(mockFlutterApi).onHideCustomView(eq(instanceIdentifier), any()); - // } } From 59a0da4740ee78958a709c6c0802198857ac1bf5 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 31 May 2023 13:10:13 -0400 Subject: [PATCH 13/35] formatting --- .../plugins/webviewflutter/FlutterViewFactory.java | 10 +++++----- .../plugins/webviewflutter/WebChromeClientTest.java | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterViewFactory.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterViewFactory.java index 70016d8e3695..0037d208ed20 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterViewFactory.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterViewFactory.java @@ -6,7 +6,6 @@ import android.content.Context; import android.view.View; - import androidx.annotation.NonNull; import androidx.annotation.Nullable; import io.flutter.plugin.common.StandardMessageCodec; @@ -41,12 +40,13 @@ public View getView() { } @Override - public void dispose() { - - } + public void dispose() {} }; } - throw new IllegalStateException(String.format("Unable to find a PlatformView or View instance: args: %s, instance: %s", args, instance)); + throw new IllegalStateException( + String.format( + "Unable to find a PlatformView or View instance: args: %s, instance: %s", + args, instance)); } } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java index 5109bc4fda0a..45caf2dfd163 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java @@ -36,7 +36,6 @@ import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; - public class WebChromeClientTest { @Rule public MockitoRule mockitoRule = MockitoJUnit.rule(); From f3693b8735e66a89b47b30087bee8d16057e0491 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 31 May 2023 13:12:22 -0400 Subject: [PATCH 14/35] fix pubspec --- .../lib/src/android_webview.dart | 3 --- .../webview_flutter_android/pubspec.yaml | 16 ---------------- 2 files changed, 19 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart index ff5b4573cb01..4e07cb555962 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart @@ -18,8 +18,6 @@ import 'instance_manager.dart'; export 'android_webview_api_impls.dart' show FileChooserMode; -import 'package:simple_ast/annotations.dart'; - /// Root of the Java class hierarchy. /// /// See https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html. @@ -969,7 +967,6 @@ class DownloadListener extends JavaObject { } /// Handles JavaScript dialogs, favicons, titles, and the progress for [WebView]. -@SimpleClassAnnotation() class WebChromeClient extends JavaObject { /// Constructs a [WebChromeClient]. WebChromeClient({ diff --git a/packages/webview_flutter/webview_flutter_android/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/pubspec.yaml index 014201ff31be..189843e4f6d6 100644 --- a/packages/webview_flutter/webview_flutter_android/pubspec.yaml +++ b/packages/webview_flutter/webview_flutter_android/pubspec.yaml @@ -20,10 +20,6 @@ flutter: dependencies: flutter: sdk: flutter - simple_ast: - git: - url: git@github.com:bparrishMines/penguin.git - path: packages/simple_ast webview_flutter_platform_interface: ^2.3.0 dev_dependencies: @@ -34,15 +30,3 @@ dev_dependencies: sdk: flutter mockito: 5.4.1 pigeon: ^9.2.4 - code_template_processor: - git: - url: git@github.com:bparrishMines/penguin.git - path: packages/code_template_processor - gen_api_impls: - git: - url: git@github.com:bparrishMines/penguin.git - path: packages/gen_api_impls - simple_ast_generator: - git: - url: git@github.com:bparrishMines/penguin.git - path: packages/simple_ast_generator From 815175050612759b999f1219eac7a473d9d812e1 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 31 May 2023 13:17:09 -0400 Subject: [PATCH 15/35] remove unneeded lines --- .../io/flutter/plugins/webviewflutter/ViewFlutterApiImpl.java | 3 --- .../plugins/webviewflutter/CustomViewCallbackTest.java | 2 -- .../test/java/io/flutter/plugins/webviewflutter/ViewTest.java | 2 -- .../flutter/plugins/webviewflutter/WebChromeClientTest.java | 4 ---- 4 files changed, 11 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewFlutterApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewFlutterApiImpl.java index 83719d380a38..653bfa9faf3d 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewFlutterApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewFlutterApiImpl.java @@ -1,10 +1,7 @@ - // 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. -// TODO(bparrishMines): Remove GenApiImpls from filename or copy classes/methods to your own implementation - package io.flutter.plugins.webviewflutter; import android.view.View; diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CustomViewCallbackTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CustomViewCallbackTest.java index df8341837aa1..3a633999532d 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CustomViewCallbackTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/CustomViewCallbackTest.java @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// TODO(bparrishMines): Remove GenApiImpls from filename or copy classes/methods to your own implementation - package io.flutter.plugins.webviewflutter; import static org.mockito.ArgumentMatchers.any; diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java index dcfbfc1f81d6..3019900d6618 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/ViewTest.java @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// TODO(bparrishMines): Remove GenApiImpls from filename or copy classes/methods to your own implementation - package io.flutter.plugins.webviewflutter; import static org.mockito.ArgumentMatchers.any; diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java index 45caf2dfd163..709da05ccc92 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java @@ -71,10 +71,6 @@ public WebChromeClientImpl createWebChromeClient( hostApiImpl = new WebChromeClientHostApiImpl(instanceManager, webChromeClientCreator, mockFlutterApi); hostApiImpl.create(2L); - - when(mockActivity.getWindow()).thenReturn(mockWindow); - when(mockWebView.getParent()).thenReturn(mockWebView); - when(mockWindow.getDecorView()).thenReturn(mockWebView); } @After From 759f19b8a678a480f1cd7d6ae69fc3c78089f761 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 31 May 2023 13:17:40 -0400 Subject: [PATCH 16/35] remove unneeded mocks --- .../flutter/plugins/webviewflutter/WebChromeClientTest.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java index 709da05ccc92..10072e5482de 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java @@ -13,11 +13,9 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import android.app.Activity; import android.net.Uri; import android.os.Message; import android.view.View; -import android.view.Window; import android.webkit.PermissionRequest; import android.webkit.WebChromeClient; import android.webkit.WebResourceRequest; @@ -45,10 +43,6 @@ public class WebChromeClientTest { @Mock public WebViewClient mockWebViewClient; - @Mock public Activity mockActivity; - - @Mock public Window mockWindow; - InstanceManager instanceManager; WebChromeClientHostApiImpl hostApiImpl; WebChromeClientImpl webChromeClient; From bdb0806310707d769fc36103e8022306cdf828b0 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Wed, 31 May 2023 13:39:32 -0400 Subject: [PATCH 17/35] fix lint --- .../io/flutter/plugins/webviewflutter/FlutterViewFactory.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterViewFactory.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterViewFactory.java index 0037d208ed20..f77bf8d95bdd 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterViewFactory.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterViewFactory.java @@ -45,8 +45,6 @@ public void dispose() {} } throw new IllegalStateException( - String.format( - "Unable to find a PlatformView or View instance: args: %s, instance: %s", - args, instance)); + "Unable to find a PlatformView or View instance: " + args + ", " + instance); } } From 5ea042df0cb1ea8ab2567507f4210d9ba6d6201a Mon Sep 17 00:00:00 2001 From: Maurits van Beusekom Date: Wed, 5 Jul 2023 20:20:38 +0200 Subject: [PATCH 18/35] Adds Dart implementation fullscreen video --- .../GeneratedAndroidWebView.java | 1048 ++++++------ .../example/lib/main.dart | 38 + .../lib/src/android_proxy.dart | 39 +- .../lib/src/android_webview.dart | 61 +- .../lib/src/android_webview.g.dart | 590 ++++--- .../lib/src/android_webview_controller.dart | 244 ++- .../webview_flutter_android/lib/test | 1426 +++++++++++++++++ .../android_navigation_delegate_test.dart | 2 + .../test/android_webview_controller_test.dart | 244 ++- ...android_webview_controller_test.mocks.dart | 54 +- ...oid_webview_cookie_manager_test.mocks.dart | 17 + .../test/test_android_webview.g.dart | 725 +++------ 12 files changed, 3078 insertions(+), 1410 deletions(-) create mode 100644 packages/webview_flutter/webview_flutter_android/lib/test diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java index cc52b0b10888..a717f3fa102b 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java @@ -18,6 +18,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -34,7 +35,8 @@ public static class FlutterError extends RuntimeException { /** The error details. Must be a datatype supported by the api codec. */ public final Object details; - public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) { + public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) + { super(message); this.code = code; this.details = details; @@ -53,7 +55,7 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); } return errorList; } @@ -61,29 +63,26 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { /** * Mode of how to select files for a file chooser. * - *

See - * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. + * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. */ public enum FileChooserMode { /** - * Open single file and requires that the file exists before allowing the user to pick it. + * Open single file and requires that the file exists before allowing the + * user to pick it. * - *

See - * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN. + * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN. */ OPEN(0), /** * Similar to [open] but allows multiple files to be selected. * - *

See - * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE. + * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE. */ OPEN_MULTIPLE(1), /** * Allows picking a nonexistent file and saving it. * - *

See - * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE. + * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE. */ SAVE(2); @@ -375,10 +374,7 @@ ArrayList toList() { static @NonNull WebResourceErrorData fromList(@NonNull ArrayList list) { WebResourceErrorData pigeonResult = new WebResourceErrorData(); Object errorCode = list.get(0); - pigeonResult.setErrorCode( - (errorCode == null) - ? null - : ((errorCode instanceof Integer) ? (Integer) errorCode : (Long) errorCode)); + pigeonResult.setErrorCode((errorCode == null) ? null : ((errorCode instanceof Integer) ? (Integer) errorCode : (Long) errorCode)); Object description = list.get(1); pigeonResult.setDescription((String) description); return pigeonResult; @@ -467,13 +463,13 @@ public interface Result { /** * Host API for managing the native `InstanceManager`. * - *

Generated interface from Pigeon that represents a handler of messages from Flutter. + * Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface InstanceManagerHostApi { /** * Clear the native `InstanceManager`. * - *

This is typically only used after a hot restart. + * This is typically only used after a hot restart. */ void clear(); @@ -481,12 +477,8 @@ public interface InstanceManagerHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `InstanceManagerHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable InstanceManagerHostApi api) { + /**Sets up an instance of `InstanceManagerHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable InstanceManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -498,7 +490,8 @@ static void setup( try { api.clear(); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -513,11 +506,11 @@ static void setup( /** * Handles methods calls to the native Java Object class. * - *

Also handles calls to remove the reference to an instance with `dispose`. + * Also handles calls to remove the reference to an instance with `dispose`. * - *

See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. + * See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. * - *

Generated interface from Pigeon that represents a handler of messages from Flutter. + * Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface JavaObjectHostApi { @@ -527,9 +520,7 @@ public interface JavaObjectHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. - */ + /**Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObjectHostApi api) { { BasicMessageChannel channel = @@ -544,7 +535,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObject try { api.dispose((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -559,9 +551,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObject /** * Handles callbacks methods for the native Java Object class. * - *

See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. + * See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. * - *

Generated class from Pigeon that represents Flutter messages that can be called from Java. + * Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class JavaObjectFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -570,7 +562,7 @@ public JavaObjectFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -579,7 +571,6 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void dispose(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -592,11 +583,11 @@ public void dispose(@NonNull Long identifierArg, @NonNull Reply callback) /** * Host API for `CookieManager`. * - *

This class may handle instantiating and adding native object instances that are attached to - * a Dart instance or handle method calls on the associated native class or an instance of the - * class. + * This class may handle instantiating and adding native object instances that + * are attached to a Dart instance or handle method calls on the associated + * native class or an instance of the class. * - *

Generated interface from Pigeon that represents a handler of messages from Flutter. + * Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CookieManagerHostApi { /** Handles attaching `CookieManager.instance` to a native instance. */ @@ -606,25 +597,18 @@ public interface CookieManagerHostApi { /** Handles Dart method `CookieManager.removeAllCookies`. */ void removeAllCookies(@NonNull Long identifier, @NonNull Result result); /** Handles Dart method `CookieManager.setAcceptThirdPartyCookies`. */ - void setAcceptThirdPartyCookies( - @NonNull Long identifier, @NonNull Long webViewIdentifier, @NonNull Boolean accept); + void setAcceptThirdPartyCookies(@NonNull Long identifier, @NonNull Long webViewIdentifier, @NonNull Boolean accept); /** The codec used by CookieManagerHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `CookieManagerHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable CookieManagerHostApi api) { + /**Sets up an instance of `CookieManagerHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CookieManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.CookieManagerHostApi.attachInstance", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.CookieManagerHostApi.attachInstance", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -632,10 +616,10 @@ static void setup( ArrayList args = (ArrayList) message; Number instanceIdentifierArg = (Number) args.get(0); try { - api.attachInstance( - (instanceIdentifierArg == null) ? null : instanceIdentifierArg.longValue()); + api.attachInstance((instanceIdentifierArg == null) ? null : instanceIdentifierArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -658,10 +642,10 @@ static void setup( String urlArg = (String) args.get(1); String valueArg = (String) args.get(2); try { - api.setCookie( - (identifierArg == null) ? null : identifierArg.longValue(), urlArg, valueArg); + api.setCookie((identifierArg == null) ? null : identifierArg.longValue(), urlArg, valueArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -674,9 +658,7 @@ static void setup( { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -696,8 +678,7 @@ public void error(Throwable error) { } }; - api.removeAllCookies( - (identifierArg == null) ? null : identifierArg.longValue(), resultCallback); + api.removeAllCookies((identifierArg == null) ? null : identifierArg.longValue(), resultCallback); }); } else { channel.setMessageHandler(null); @@ -706,9 +687,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -718,12 +697,10 @@ public void error(Throwable error) { Number webViewIdentifierArg = (Number) args.get(1); Boolean acceptArg = (Boolean) args.get(2); try { - api.setAcceptThirdPartyCookies( - (identifierArg == null) ? null : identifierArg.longValue(), - (webViewIdentifierArg == null) ? null : webViewIdentifierArg.longValue(), - acceptArg); + api.setAcceptThirdPartyCookies((identifierArg == null) ? null : identifierArg.longValue(), (webViewIdentifierArg == null) ? null : webViewIdentifierArg.longValue(), acceptArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -767,32 +744,21 @@ public interface WebViewHostApi { void create(@NonNull Long instanceId); - void loadData( - @NonNull Long instanceId, - @NonNull String data, - @Nullable String mimeType, - @Nullable String encoding); + void loadData(@NonNull Long instanceId, @NonNull String data, @Nullable String mimeType, @Nullable String encoding); - void loadDataWithBaseUrl( - @NonNull Long instanceId, - @Nullable String baseUrl, - @NonNull String data, - @Nullable String mimeType, - @Nullable String encoding, - @Nullable String historyUrl); + void loadDataWithBaseUrl(@NonNull Long instanceId, @Nullable String baseUrl, @NonNull String data, @Nullable String mimeType, @Nullable String encoding, @Nullable String historyUrl); - void loadUrl( - @NonNull Long instanceId, @NonNull String url, @NonNull Map headers); + void loadUrl(@NonNull Long instanceId, @NonNull String url, @NonNull Map headers); void postUrl(@NonNull Long instanceId, @NonNull String url, @NonNull byte[] data); - @Nullable + @Nullable String getUrl(@NonNull Long instanceId); - @NonNull + @NonNull Boolean canGoBack(@NonNull Long instanceId); - @NonNull + @NonNull Boolean canGoForward(@NonNull Long instanceId); void goBack(@NonNull Long instanceId); @@ -803,23 +769,22 @@ void loadUrl( void clearCache(@NonNull Long instanceId, @NonNull Boolean includeDiskFiles); - void evaluateJavascript( - @NonNull Long instanceId, @NonNull String javascriptString, @NonNull Result result); + void evaluateJavascript(@NonNull Long instanceId, @NonNull String javascriptString, @NonNull Result result); - @Nullable + @Nullable String getTitle(@NonNull Long instanceId); void scrollTo(@NonNull Long instanceId, @NonNull Long x, @NonNull Long y); void scrollBy(@NonNull Long instanceId, @NonNull Long x, @NonNull Long y); - @NonNull + @NonNull Long getScrollX(@NonNull Long instanceId); - @NonNull + @NonNull Long getScrollY(@NonNull Long instanceId); - @NonNull + @NonNull WebViewPoint getScrollPosition(@NonNull Long instanceId); void setWebContentsDebuggingEnabled(@NonNull Boolean enabled); @@ -828,8 +793,7 @@ void evaluateJavascript( void addJavaScriptChannel(@NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId); - void removeJavaScriptChannel( - @NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId); + void removeJavaScriptChannel(@NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId); void setDownloadListener(@NonNull Long instanceId, @Nullable Long listenerInstanceId); @@ -841,7 +805,7 @@ void removeJavaScriptChannel( static @NonNull MessageCodec getCodec() { return WebViewHostApiCodec.INSTANCE; } - /** Sets up an instance of `WebViewHostApi` to handle messages through the `binaryMessenger`. */ + /**Sets up an instance of `WebViewHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHostApi api) { { BasicMessageChannel channel = @@ -856,7 +820,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -880,13 +845,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos String mimeTypeArg = (String) args.get(2); String encodingArg = (String) args.get(3); try { - api.loadData( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - dataArg, - mimeTypeArg, - encodingArg); + api.loadData((instanceIdArg == null) ? null : instanceIdArg.longValue(), dataArg, mimeTypeArg, encodingArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -899,9 +861,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -914,15 +874,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos String encodingArg = (String) args.get(4); String historyUrlArg = (String) args.get(5); try { - api.loadDataWithBaseUrl( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - baseUrlArg, - dataArg, - mimeTypeArg, - encodingArg, - historyUrlArg); + api.loadDataWithBaseUrl((instanceIdArg == null) ? null : instanceIdArg.longValue(), baseUrlArg, dataArg, mimeTypeArg, encodingArg, historyUrlArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -945,12 +900,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos String urlArg = (String) args.get(1); Map headersArg = (Map) args.get(2); try { - api.loadUrl( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - urlArg, - headersArg); + api.loadUrl((instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, headersArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -973,10 +926,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos String urlArg = (String) args.get(1); byte[] dataArg = (byte[]) args.get(2); try { - api.postUrl( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, dataArg); + api.postUrl((instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, dataArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -997,10 +950,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - String output = - api.getUrl((instanceIdArg == null) ? null : instanceIdArg.longValue()); + String output = api.getUrl((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1021,10 +974,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - Boolean output = - api.canGoBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); + Boolean output = api.canGoBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1045,10 +998,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - Boolean output = - api.canGoForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); + Boolean output = api.canGoForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1071,7 +1024,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos try { api.goBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1094,7 +1048,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos try { api.goForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1117,7 +1072,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos try { api.reload((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1139,11 +1095,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos Number instanceIdArg = (Number) args.get(0); Boolean includeDiskFilesArg = (Boolean) args.get(1); try { - api.clearCache( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - includeDiskFilesArg); + api.clearCache((instanceIdArg == null) ? null : instanceIdArg.longValue(), includeDiskFilesArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1156,9 +1111,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.evaluateJavascript", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.evaluateJavascript", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1179,10 +1132,7 @@ public void error(Throwable error) { } }; - api.evaluateJavascript( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - javascriptStringArg, - resultCallback); + api.evaluateJavascript((instanceIdArg == null) ? null : instanceIdArg.longValue(), javascriptStringArg, resultCallback); }); } else { channel.setMessageHandler(null); @@ -1199,10 +1149,10 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - String output = - api.getTitle((instanceIdArg == null) ? null : instanceIdArg.longValue()); + String output = api.getTitle((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1225,12 +1175,10 @@ public void error(Throwable error) { Number xArg = (Number) args.get(1); Number yArg = (Number) args.get(2); try { - api.scrollTo( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (xArg == null) ? null : xArg.longValue(), - (yArg == null) ? null : yArg.longValue()); + api.scrollTo((instanceIdArg == null) ? null : instanceIdArg.longValue(), (xArg == null) ? null : xArg.longValue(), (yArg == null) ? null : yArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1253,12 +1201,10 @@ public void error(Throwable error) { Number xArg = (Number) args.get(1); Number yArg = (Number) args.get(2); try { - api.scrollBy( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (xArg == null) ? null : xArg.longValue(), - (yArg == null) ? null : yArg.longValue()); + api.scrollBy((instanceIdArg == null) ? null : instanceIdArg.longValue(), (xArg == null) ? null : xArg.longValue(), (yArg == null) ? null : yArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1279,10 +1225,10 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - Long output = - api.getScrollX((instanceIdArg == null) ? null : instanceIdArg.longValue()); + Long output = api.getScrollX((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1303,10 +1249,10 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - Long output = - api.getScrollY((instanceIdArg == null) ? null : instanceIdArg.longValue()); + Long output = api.getScrollY((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1327,11 +1273,10 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - WebViewPoint output = - api.getScrollPosition( - (instanceIdArg == null) ? null : instanceIdArg.longValue()); + WebViewPoint output = api.getScrollPosition((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1344,9 +1289,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1356,7 +1299,8 @@ public void error(Throwable error) { try { api.setWebContentsDebuggingEnabled(enabledArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1378,13 +1322,10 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number webViewClientInstanceIdArg = (Number) args.get(1); try { - api.setWebViewClient( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (webViewClientInstanceIdArg == null) - ? null - : webViewClientInstanceIdArg.longValue()); + api.setWebViewClient((instanceIdArg == null) ? null : instanceIdArg.longValue(), (webViewClientInstanceIdArg == null) ? null : webViewClientInstanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1397,9 +1338,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1408,13 +1347,10 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number javaScriptChannelInstanceIdArg = (Number) args.get(1); try { - api.addJavaScriptChannel( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (javaScriptChannelInstanceIdArg == null) - ? null - : javaScriptChannelInstanceIdArg.longValue()); + api.addJavaScriptChannel((instanceIdArg == null) ? null : instanceIdArg.longValue(), (javaScriptChannelInstanceIdArg == null) ? null : javaScriptChannelInstanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1427,9 +1363,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1438,13 +1372,10 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number javaScriptChannelInstanceIdArg = (Number) args.get(1); try { - api.removeJavaScriptChannel( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (javaScriptChannelInstanceIdArg == null) - ? null - : javaScriptChannelInstanceIdArg.longValue()); + api.removeJavaScriptChannel((instanceIdArg == null) ? null : instanceIdArg.longValue(), (javaScriptChannelInstanceIdArg == null) ? null : javaScriptChannelInstanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1457,9 +1388,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.setDownloadListener", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setDownloadListener", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1468,11 +1397,10 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number listenerInstanceIdArg = (Number) args.get(1); try { - api.setDownloadListener( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (listenerInstanceIdArg == null) ? null : listenerInstanceIdArg.longValue()); + api.setDownloadListener((instanceIdArg == null) ? null : instanceIdArg.longValue(), (listenerInstanceIdArg == null) ? null : listenerInstanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1485,9 +1413,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.setWebChromeClient", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setWebChromeClient", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1496,11 +1422,10 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number clientInstanceIdArg = (Number) args.get(1); try { - api.setWebChromeClient( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (clientInstanceIdArg == null) ? null : clientInstanceIdArg.longValue()); + api.setWebChromeClient((instanceIdArg == null) ? null : instanceIdArg.longValue(), (clientInstanceIdArg == null) ? null : clientInstanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1513,9 +1438,7 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewHostApi.setBackgroundColor", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setBackgroundColor", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1524,11 +1447,10 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number colorArg = (Number) args.get(1); try { - api.setBackgroundColor( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (colorArg == null) ? null : colorArg.longValue()); + api.setBackgroundColor((instanceIdArg == null) ? null : instanceIdArg.longValue(), (colorArg == null) ? null : colorArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1543,12 +1465,13 @@ public void error(Throwable error) { /** * Flutter API for `WebView`. * - *

This class may handle instantiating and adding Dart instances that are attached to a native - * instance or receiving callback methods from an overridden native class. + * This class may handle instantiating and adding Dart instances that are + * attached to a native instance or receiving callback methods from an + * overridden native class. * - *

See https://developer.android.com/reference/android/webkit/WebView. + * See https://developer.android.com/reference/android/webkit/WebView. * - *

Generated class from Pigeon that represents Flutter messages that can be called from Java. + * Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class WebViewFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -1557,7 +1480,7 @@ public WebViewFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1611,9 +1534,7 @@ public interface WebSettingsHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `WebSettingsHostApi` to handle messages through the `binaryMessenger`. - */ + /**Sets up an instance of `WebSettingsHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSettingsHostApi api) { { BasicMessageChannel channel = @@ -1627,11 +1548,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Number webViewInstanceIdArg = (Number) args.get(1); try { - api.create( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (webViewInstanceIdArg == null) ? null : webViewInstanceIdArg.longValue()); + api.create((instanceIdArg == null) ? null : instanceIdArg.longValue(), (webViewInstanceIdArg == null) ? null : webViewInstanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1644,9 +1564,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1655,10 +1573,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean flagArg = (Boolean) args.get(1); try { - api.setDomStorageEnabled( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); + api.setDomStorageEnabled((instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1671,9 +1589,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1682,10 +1598,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean flagArg = (Boolean) args.get(1); try { - api.setJavaScriptCanOpenWindowsAutomatically( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); + api.setJavaScriptCanOpenWindowsAutomatically((instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1698,9 +1614,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1709,10 +1623,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean supportArg = (Boolean) args.get(1); try { - api.setSupportMultipleWindows( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); + api.setSupportMultipleWindows((instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1725,9 +1639,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1736,10 +1648,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean flagArg = (Boolean) args.get(1); try { - api.setJavaScriptEnabled( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); + api.setJavaScriptEnabled((instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1752,9 +1664,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1763,11 +1673,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); String userAgentStringArg = (String) args.get(1); try { - api.setUserAgentString( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - userAgentStringArg); + api.setUserAgentString((instanceIdArg == null) ? null : instanceIdArg.longValue(), userAgentStringArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1780,9 +1689,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1791,10 +1698,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean requireArg = (Boolean) args.get(1); try { - api.setMediaPlaybackRequiresUserGesture( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), requireArg); + api.setMediaPlaybackRequiresUserGesture((instanceIdArg == null) ? null : instanceIdArg.longValue(), requireArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1807,9 +1714,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1818,10 +1723,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean supportArg = (Boolean) args.get(1); try { - api.setSupportZoom( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); + api.setSupportZoom((instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1834,9 +1739,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1845,10 +1748,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean overviewArg = (Boolean) args.get(1); try { - api.setLoadWithOverviewMode( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), overviewArg); + api.setLoadWithOverviewMode((instanceIdArg == null) ? null : instanceIdArg.longValue(), overviewArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1861,9 +1764,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1872,10 +1773,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean useArg = (Boolean) args.get(1); try { - api.setUseWideViewPort( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), useArg); + api.setUseWideViewPort((instanceIdArg == null) ? null : instanceIdArg.longValue(), useArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1888,9 +1789,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1899,10 +1798,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean enabledArg = (Boolean) args.get(1); try { - api.setDisplayZoomControls( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); + api.setDisplayZoomControls((instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1915,9 +1814,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1926,10 +1823,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean enabledArg = (Boolean) args.get(1); try { - api.setBuiltInZoomControls( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); + api.setBuiltInZoomControls((instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1942,9 +1839,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1953,10 +1848,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean enabledArg = (Boolean) args.get(1); try { - api.setAllowFileAccess( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); + api.setAllowFileAccess((instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1978,11 +1873,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Number textZoomArg = (Number) args.get(1); try { - api.setTextZoom( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - (textZoomArg == null) ? null : textZoomArg.longValue()); + api.setTextZoom((instanceIdArg == null) ? null : instanceIdArg.longValue(), (textZoomArg == null) ? null : textZoomArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2003,12 +1897,8 @@ public interface JavaScriptChannelHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `JavaScriptChannelHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable JavaScriptChannelHostApi api) { + /**Sets up an instance of `JavaScriptChannelHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaScriptChannelHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2021,10 +1911,10 @@ static void setup( Number instanceIdArg = (Number) args.get(0); String channelNameArg = (String) args.get(1); try { - api.create( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), channelNameArg); + api.create((instanceIdArg == null) ? null : instanceIdArg.longValue(), channelNameArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2044,7 +1934,7 @@ public JavaScriptChannelFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2053,14 +1943,10 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - - public void postMessage( - @NonNull Long instanceIdArg, @NonNull String messageArg, @NonNull Reply callback) { + public void postMessage(@NonNull Long instanceIdArg, @NonNull String messageArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage", getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, messageArg)), channelReply -> callback.reply(null)); @@ -2071,19 +1957,14 @@ public interface WebViewClientHostApi { void create(@NonNull Long instanceId); - void setSynchronousReturnValueForShouldOverrideUrlLoading( - @NonNull Long instanceId, @NonNull Boolean value); + void setSynchronousReturnValueForShouldOverrideUrlLoading(@NonNull Long instanceId, @NonNull Boolean value); /** The codec used by WebViewClientHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `WebViewClientHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable WebViewClientHostApi api) { + /**Sets up an instance of `WebViewClientHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewClientHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2097,7 +1978,8 @@ static void setup( try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2110,9 +1992,7 @@ static void setup( { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2121,10 +2001,10 @@ static void setup( Number instanceIdArg = (Number) args.get(0); Boolean valueArg = (Boolean) args.get(1); try { - api.setSynchronousReturnValueForShouldOverrideUrlLoading( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); + api.setSynchronousReturnValueForShouldOverrideUrlLoading((instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2176,7 +2056,7 @@ public WebViewClientFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2185,97 +2065,47 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return WebViewClientFlutterApiCodec.INSTANCE; } - - public void onPageStarted( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull String urlArg, - @NonNull Reply callback) { + public void onPageStarted(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted", getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), channelReply -> callback.reply(null)); } - - public void onPageFinished( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull String urlArg, - @NonNull Reply callback) { + public void onPageFinished(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished", getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), channelReply -> callback.reply(null)); } - - public void onReceivedRequestError( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull WebResourceRequestData requestArg, - @NonNull WebResourceErrorData errorArg, - @NonNull Reply callback) { + public void onReceivedRequestError(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull WebResourceRequestData requestArg, @NonNull WebResourceErrorData errorArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError", getCodec()); channel.send( - new ArrayList( - Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg, errorArg)), + new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg, errorArg)), channelReply -> callback.reply(null)); } - - public void onReceivedError( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull Long errorCodeArg, - @NonNull String descriptionArg, - @NonNull String failingUrlArg, - @NonNull Reply callback) { + public void onReceivedError(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull Long errorCodeArg, @NonNull String descriptionArg, @NonNull String failingUrlArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError", getCodec()); channel.send( - new ArrayList( - Arrays.asList( - instanceIdArg, - webViewInstanceIdArg, - errorCodeArg, - descriptionArg, - failingUrlArg)), + new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, errorCodeArg, descriptionArg, failingUrlArg)), channelReply -> callback.reply(null)); } - - public void requestLoading( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull WebResourceRequestData requestArg, - @NonNull Reply callback) { + public void requestLoading(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull WebResourceRequestData requestArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading", getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg)), channelReply -> callback.reply(null)); } - - public void urlLoading( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull String urlArg, - @NonNull Reply callback) { + public void urlLoading(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading", getCodec()); @@ -2283,21 +2113,12 @@ public void urlLoading( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), channelReply -> callback.reply(null)); } - - public void doUpdateVisitedHistory( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull String urlArg, - @NonNull Boolean isReloadArg, - @NonNull Reply callback) { + public void doUpdateVisitedHistory(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Boolean isReloadArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory", getCodec()); channel.send( - new ArrayList( - Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg, isReloadArg)), + new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg, isReloadArg)), channelReply -> callback.reply(null)); } } @@ -2310,12 +2131,8 @@ public interface DownloadListenerHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `DownloadListenerHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable DownloadListenerHostApi api) { + /**Sets up an instance of `DownloadListenerHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DownloadListenerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2329,7 +2146,8 @@ static void setup( try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2349,7 +2167,7 @@ public DownloadListenerFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2358,29 +2176,12 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - - public void onDownloadStart( - @NonNull Long instanceIdArg, - @NonNull String urlArg, - @NonNull String userAgentArg, - @NonNull String contentDispositionArg, - @NonNull String mimetypeArg, - @NonNull Long contentLengthArg, - @NonNull Reply callback) { + public void onDownloadStart(@NonNull Long instanceIdArg, @NonNull String urlArg, @NonNull String userAgentArg, @NonNull String contentDispositionArg, @NonNull String mimetypeArg, @NonNull Long contentLengthArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart", getCodec()); channel.send( - new ArrayList( - Arrays.asList( - instanceIdArg, - urlArg, - userAgentArg, - contentDispositionArg, - mimetypeArg, - contentLengthArg)), + new ArrayList(Arrays.asList(instanceIdArg, urlArg, userAgentArg, contentDispositionArg, mimetypeArg, contentLengthArg)), channelReply -> callback.reply(null)); } } @@ -2389,19 +2190,14 @@ public interface WebChromeClientHostApi { void create(@NonNull Long instanceId); - void setSynchronousReturnValueForOnShowFileChooser( - @NonNull Long instanceId, @NonNull Boolean value); + void setSynchronousReturnValueForOnShowFileChooser(@NonNull Long instanceId, @NonNull Boolean value); /** The codec used by WebChromeClientHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `WebChromeClientHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeClientHostApi api) { + /**Sets up an instance of `WebChromeClientHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeClientHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2415,7 +2211,8 @@ static void setup( try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2428,9 +2225,7 @@ static void setup( { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2439,10 +2234,10 @@ static void setup( Number instanceIdArg = (Number) args.get(0); Boolean valueArg = (Boolean) args.get(1); try { - api.setSynchronousReturnValueForOnShowFileChooser( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); + api.setSynchronousReturnValueForOnShowFileChooser((instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2457,22 +2252,18 @@ static void setup( /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface FlutterAssetManagerHostApi { - @NonNull + @NonNull List list(@NonNull String path); - @NonNull + @NonNull String getAssetFilePathByName(@NonNull String name); /** The codec used by FlutterAssetManagerHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `FlutterAssetManagerHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable FlutterAssetManagerHostApi api) { + /**Sets up an instance of `FlutterAssetManagerHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable FlutterAssetManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2486,7 +2277,8 @@ static void setup( try { List output = api.list(pathArg); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2499,9 +2291,7 @@ static void setup( { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2511,7 +2301,8 @@ static void setup( try { String output = api.getAssetFilePathByName(nameArg); wrapped.add(0, output); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2531,7 +2322,7 @@ public WebChromeClientFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2540,35 +2331,20 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - - public void onProgressChanged( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull Long progressArg, - @NonNull Reply callback) { + public void onProgressChanged(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull Long progressArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged", getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, progressArg)), channelReply -> callback.reply(null)); } - - public void onShowFileChooser( - @NonNull Long instanceIdArg, - @NonNull Long webViewInstanceIdArg, - @NonNull Long paramsInstanceIdArg, - @NonNull Reply> callback) { + public void onShowFileChooser(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull Long paramsInstanceIdArg, @NonNull Reply> callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser", getCodec()); channel.send( - new ArrayList( - Arrays.asList(instanceIdArg, webViewInstanceIdArg, paramsInstanceIdArg)), + new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, paramsInstanceIdArg)), channelReply -> { @SuppressWarnings("ConstantConditions") List output = (List) channelReply; @@ -2576,42 +2352,46 @@ public void onShowFileChooser( }); } /** Callback to Dart function `WebChromeClient.onPermissionRequest`. */ - public void onPermissionRequest( - @NonNull Long instanceIdArg, - @NonNull Long requestInstanceIdArg, - @NonNull Reply callback) { + public void onPermissionRequest(@NonNull Long instanceIdArg, @NonNull Long requestInstanceIdArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest", getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, requestInstanceIdArg)), channelReply -> callback.reply(null)); } + /** Callback to Dart function `WebChromeClient.onShowCustomView`. */ + public void onShowCustomView(@NonNull Long instanceIdArg, @NonNull Long viewIdentifierArg, @NonNull Long callbackIdentifierArg, @NonNull Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView", getCodec()); + channel.send( + new ArrayList(Arrays.asList(instanceIdArg, viewIdentifierArg, callbackIdentifierArg)), + channelReply -> callback.reply(null)); + } + /** Callback to Dart function `WebChromeClient.onHideCustomView`. */ + public void onHideCustomView(@NonNull Long instanceIdArg, @NonNull Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onHideCustomView", getCodec()); + channel.send( + new ArrayList(Collections.singletonList(instanceIdArg)), + channelReply -> callback.reply(null)); + } /** Callback to Dart function `WebChromeClient.onGeolocationPermissionsShowPrompt`. */ - public void onGeolocationPermissionsShowPrompt( - @NonNull Long instanceIdArg, - @NonNull Long paramsInstanceIdArg, - @NonNull String originArg, - @NonNull Reply callback) { + public void onGeolocationPermissionsShowPrompt(@NonNull Long instanceIdArg, @NonNull Long paramsInstanceIdArg, @NonNull String originArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsShowPrompt", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsShowPrompt", getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, paramsInstanceIdArg, originArg)), channelReply -> callback.reply(null)); } /** Callback to Dart function `WebChromeClient.onGeolocationPermissionsHidePrompt`. */ - public void onGeolocationPermissionsHidePrompt( - @NonNull Long identifierArg, @NonNull Reply callback) { + public void onGeolocationPermissionsHidePrompt(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsHidePrompt", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsHidePrompt", getCodec()); channel.send( new ArrayList(Collections.singletonList(identifierArg)), channelReply -> callback.reply(null)); @@ -2628,9 +2408,7 @@ public interface WebStorageHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `WebStorageHostApi` to handle messages through the `binaryMessenger`. - */ + /**Sets up an instance of `WebStorageHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorageHostApi api) { { BasicMessageChannel channel = @@ -2645,7 +2423,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorage try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2668,7 +2447,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorage try { api.deleteAllData((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2682,8 +2462,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorage } private static class FileChooserParamsFlutterApiCodec extends StandardMessageCodec { - public static final FileChooserParamsFlutterApiCodec INSTANCE = - new FileChooserParamsFlutterApiCodec(); + public static final FileChooserParamsFlutterApiCodec INSTANCE = new FileChooserParamsFlutterApiCodec(); private FileChooserParamsFlutterApiCodec() {} @@ -2711,10 +2490,9 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { /** * Handles callbacks methods for the native Java FileChooserParams class. * - *

See - * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. + * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. * - *

Generated class from Pigeon that represents Flutter messages that can be called from Java. + * Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class FileChooserParamsFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2723,7 +2501,7 @@ public FileChooserParamsFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2732,34 +2510,25 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return FileChooserParamsFlutterApiCodec.INSTANCE; } - - public void create( - @NonNull Long instanceIdArg, - @NonNull Boolean isCaptureEnabledArg, - @NonNull List acceptTypesArg, - @NonNull FileChooserModeEnumData modeArg, - @Nullable String filenameHintArg, - @NonNull Reply callback) { + public void create(@NonNull Long instanceIdArg, @NonNull Boolean isCaptureEnabledArg, @NonNull List acceptTypesArg, @NonNull FileChooserModeEnumData modeArg, @Nullable String filenameHintArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.FileChooserParamsFlutterApi.create", getCodec()); channel.send( - new ArrayList( - Arrays.asList( - instanceIdArg, isCaptureEnabledArg, acceptTypesArg, modeArg, filenameHintArg)), + new ArrayList(Arrays.asList(instanceIdArg, isCaptureEnabledArg, acceptTypesArg, modeArg, filenameHintArg)), channelReply -> callback.reply(null)); } } /** * Host API for `PermissionRequest`. * - *

This class may handle instantiating and adding native object instances that are attached to - * a Dart instance or handle method calls on the associated native class or an instance of the - * class. + * This class may handle instantiating and adding native object instances that + * are attached to a Dart instance or handle method calls on the associated + * native class or an instance of the class. * - *

See https://developer.android.com/reference/android/webkit/PermissionRequest. + * See https://developer.android.com/reference/android/webkit/PermissionRequest. * - *

Generated interface from Pigeon that represents a handler of messages from Flutter. + * Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface PermissionRequestHostApi { /** Handles Dart method `PermissionRequest.grant`. */ @@ -2771,12 +2540,8 @@ public interface PermissionRequestHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `PermissionRequestHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, @Nullable PermissionRequestHostApi api) { + /**Sets up an instance of `PermissionRequestHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PermissionRequestHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2789,10 +2554,10 @@ static void setup( Number instanceIdArg = (Number) args.get(0); List resourcesArg = (List) args.get(1); try { - api.grant( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), resourcesArg); + api.grant((instanceIdArg == null) ? null : instanceIdArg.longValue(), resourcesArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2815,7 +2580,8 @@ static void setup( try { api.deny((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2830,12 +2596,13 @@ static void setup( /** * Flutter API for `PermissionRequest`. * - *

This class may handle instantiating and adding Dart instances that are attached to a native - * instance or receiving callback methods from an overridden native class. + * This class may handle instantiating and adding Dart instances that are + * attached to a native instance or receiving callback methods from an + * overridden native class. * - *

See https://developer.android.com/reference/android/webkit/PermissionRequest. + * See https://developer.android.com/reference/android/webkit/PermissionRequest. * - *

Generated class from Pigeon that represents Flutter messages that can be called from Java. + * Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class PermissionRequestFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2844,7 +2611,7 @@ public PermissionRequestFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2854,10 +2621,7 @@ public interface Reply { return new StandardMessageCodec(); } /** Create a new Dart instance and add it to the `InstanceManager`. */ - public void create( - @NonNull Long instanceIdArg, - @NonNull List resourcesArg, - @NonNull Reply callback) { + public void create(@NonNull Long instanceIdArg, @NonNull List resourcesArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.PermissionRequestFlutterApi.create", getCodec()); @@ -2866,42 +2630,152 @@ public void create( channelReply -> callback.reply(null)); } } + /** + * Host API for `CustomViewCallback`. + * + * This class may handle instantiating and adding native object instances that + * are attached to a Dart instance or handle method calls on the associated + * native class or an instance of the class. + * + * See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. + * + * Generated interface from Pigeon that represents a handler of messages from Flutter. + */ + public interface CustomViewCallbackHostApi { + /** Handles Dart method `CustomViewCallback.onCustomViewHidden`. */ + void onCustomViewHidden(@NonNull Long identifier); + + /** The codec used by CustomViewCallbackHostApi. */ + static @NonNull MessageCodec getCodec() { + return new StandardMessageCodec(); + } + /**Sets up an instance of `CustomViewCallbackHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CustomViewCallbackHostApi api) { + { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden", getCodec()); + if (api != null) { + channel.setMessageHandler( + (message, reply) -> { + ArrayList wrapped = new ArrayList(); + ArrayList args = (ArrayList) message; + Number identifierArg = (Number) args.get(0); + try { + api.onCustomViewHidden((identifierArg == null) ? null : identifierArg.longValue()); + wrapped.add(0, null); + } + catch (Throwable exception) { + ArrayList wrappedError = wrapError(exception); + wrapped = wrappedError; + } + reply.reply(wrapped); + }); + } else { + channel.setMessageHandler(null); + } + } + } + } + /** + * Flutter API for `CustomViewCallback`. + * + * This class may handle instantiating and adding Dart instances that are + * attached to a native instance or receiving callback methods from an + * overridden native class. + * + * See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. + * + * Generated class from Pigeon that represents Flutter messages that can be called from Java. + */ + public static class CustomViewCallbackFlutterApi { + private final @NonNull BinaryMessenger binaryMessenger; + + public CustomViewCallbackFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { + this.binaryMessenger = argBinaryMessenger; + } + + /** Public interface for sending reply. */ + @SuppressWarnings("UnknownNullness") + public interface Reply { + void reply(T reply); + } + /** The codec used by CustomViewCallbackFlutterApi. */ + static @NonNull MessageCodec getCodec() { + return new StandardMessageCodec(); + } + /** Create a new Dart instance and add it to the `InstanceManager`. */ + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.CustomViewCallbackFlutterApi.create", getCodec()); + channel.send( + new ArrayList(Collections.singletonList(identifierArg)), + channelReply -> callback.reply(null)); + } + } + /** + * Flutter API for `View`. + * + * This class may handle instantiating and adding Dart instances that are + * attached to a native instance or receiving callback methods from an + * overridden native class. + * + * See https://developer.android.com/reference/android/view/View. + * + * Generated class from Pigeon that represents Flutter messages that can be called from Java. + */ + public static class ViewFlutterApi { + private final @NonNull BinaryMessenger binaryMessenger; + + public ViewFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { + this.binaryMessenger = argBinaryMessenger; + } + + /** Public interface for sending reply. */ + @SuppressWarnings("UnknownNullness") + public interface Reply { + void reply(T reply); + } + /** The codec used by ViewFlutterApi. */ + static @NonNull MessageCodec getCodec() { + return new StandardMessageCodec(); + } + /** Create a new Dart instance and add it to the `InstanceManager`. */ + public void create(@NonNull Long identifierArg, @NonNull Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.ViewFlutterApi.create", getCodec()); + channel.send( + new ArrayList(Collections.singletonList(identifierArg)), + channelReply -> callback.reply(null)); + } + } /** * Host API for `GeolocationPermissionsCallback`. * - *

This class may handle instantiating and adding native object instances that are attached to - * a Dart instance or handle method calls on the associated native class or an instance of the - * class. + * This class may handle instantiating and adding native object instances that + * are attached to a Dart instance or handle method calls on the associated + * native class or an instance of the class. * - *

See https://developer.android.com/reference/android/webkit/GeolocationPermissions.Callback. + * See https://developer.android.com/reference/android/webkit/GeolocationPermissions.Callback. * - *

Generated interface from Pigeon that represents a handler of messages from Flutter. + * Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface GeolocationPermissionsCallbackHostApi { /** Handles Dart method `GeolocationPermissionsCallback.invoke`. */ - void invoke( - @NonNull Long instanceId, - @NonNull String origin, - @NonNull Boolean allow, - @NonNull Boolean retain); + void invoke(@NonNull Long instanceId, @NonNull String origin, @NonNull Boolean allow, @NonNull Boolean retain); /** The codec used by GeolocationPermissionsCallbackHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /** - * Sets up an instance of `GeolocationPermissionsCallbackHostApi` to handle messages through the - * `binaryMessenger`. - */ - static void setup( - @NonNull BinaryMessenger binaryMessenger, - @Nullable GeolocationPermissionsCallbackHostApi api) { + /**Sets up an instance of `GeolocationPermissionsCallbackHostApi` to handle messages through the `binaryMessenger`. */ + static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable GeolocationPermissionsCallbackHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.GeolocationPermissionsCallbackHostApi.invoke", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.GeolocationPermissionsCallbackHostApi.invoke", getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2912,13 +2786,10 @@ static void setup( Boolean allowArg = (Boolean) args.get(2); Boolean retainArg = (Boolean) args.get(3); try { - api.invoke( - (instanceIdArg == null) ? null : instanceIdArg.longValue(), - originArg, - allowArg, - retainArg); + api.invoke((instanceIdArg == null) ? null : instanceIdArg.longValue(), originArg, allowArg, retainArg); wrapped.add(0, null); - } catch (Throwable exception) { + } + catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2933,12 +2804,13 @@ static void setup( /** * Flutter API for `GeolocationPermissionsCallback`. * - *

This class may handle instantiating and adding Dart instances that are attached to a native - * instance or receiving callback methods from an overridden native class. + * This class may handle instantiating and adding Dart instances that are + * attached to a native instance or receiving callback methods from an + * overridden native class. * - *

See https://developer.android.com/reference/android/webkit/GeolocationPermissions.Callback. + * See https://developer.android.com/reference/android/webkit/GeolocationPermissions.Callback. * - *

Generated class from Pigeon that represents Flutter messages that can be called from Java. + * Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class GeolocationPermissionsCallbackFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2947,7 +2819,7 @@ public GeolocationPermissionsCallbackFlutterApi(@NonNull BinaryMessenger argBina this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2960,9 +2832,7 @@ public interface Reply { public void create(@NonNull Long instanceIdArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, - "dev.flutter.pigeon.GeolocationPermissionsCallbackFlutterApi.create", - getCodec()); + binaryMessenger, "dev.flutter.pigeon.GeolocationPermissionsCallbackFlutterApi.create", getCodec()); channel.send( new ArrayList(Collections.singletonList(instanceIdArg)), channelReply -> callback.reply(null)); diff --git a/packages/webview_flutter/webview_flutter_android/example/lib/main.dart b/packages/webview_flutter/webview_flutter_android/example/lib/main.dart index b618c8f3e2cc..a80d4d2f973e 100644 --- a/packages/webview_flutter/webview_flutter_android/example/lib/main.dart +++ b/packages/webview_flutter/webview_flutter_android/example/lib/main.dart @@ -33,6 +33,19 @@ The navigation delegate is set to block navigation to the youtube website. '''; +const String kVideoExamplePage = ''' + +Video example + + + + +'''; + const String kLocalExamplePage = ''' @@ -200,6 +213,7 @@ enum MenuOptions { loadHtmlString, transparentBackground, setCookie, + videoExample, } class SampleMenu extends StatelessWidget { @@ -260,6 +274,9 @@ class SampleMenu extends StatelessWidget { case MenuOptions.setCookie: _onSetCookie(); break; + case MenuOptions.videoExample: + _onVideoExample(context); + break; } }, itemBuilder: (BuildContext context) => >[ @@ -316,6 +333,10 @@ class SampleMenu extends StatelessWidget { value: MenuOptions.transparentBackground, child: Text('Transparent background example'), ), + const PopupMenuItem( + value: MenuOptions.videoExample, + child: Text('Video example'), + ), ], ); } @@ -411,6 +432,23 @@ class SampleMenu extends StatelessWidget { )); } + Future _onVideoExample(BuildContext context) { + final AndroidWebViewController androidController = + webViewController as AndroidWebViewController; + androidController.setCustomViewCallbacks( + onShowCustomView: + (AndroidCustomViewWidget widget, OnHideCustomViewCallback callback) { + Navigator.of(context).push(MaterialPageRoute( + builder: (BuildContext context) => widget, + fullscreenDialog: true, + )); + }, + onHideCustomView: () {}, + ); + + return androidController.loadHtmlString(kVideoExamplePage); + } + Future _onDoPostRequest() { return webViewController.loadRequest(LoadRequestParams( uri: Uri.parse('https://httpbin.org/post'), diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_proxy.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_proxy.dart index e95de8cfa6f1..508a31bbe5fc 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_proxy.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_proxy.dart @@ -28,22 +28,29 @@ class AndroidWebViewProxy { final android_webview.WebView Function() createAndroidWebView; /// Constructs a [android_webview.WebChromeClient]. - final android_webview.WebChromeClient Function( - {void Function(android_webview.WebView webView, int progress)? - onProgressChanged, - Future> Function( - android_webview.WebView webView, - android_webview.FileChooserParams params, - )? onShowFileChooser, - void Function( - android_webview.WebChromeClient instance, - android_webview.PermissionRequest request, - )? onPermissionRequest, - Future Function(String origin, - android_webview.GeolocationPermissionsCallback callback)? - onGeolocationPermissionsShowPrompt, - void Function(android_webview.WebChromeClient instance)? - onGeolocationPermissionsHidePrompt}) createAndroidWebChromeClient; + final android_webview.WebChromeClient Function({ + void Function(android_webview.WebView webView, int progress)? + onProgressChanged, + Future> Function( + android_webview.WebView webView, + android_webview.FileChooserParams params, + )? onShowFileChooser, + void Function( + android_webview.WebChromeClient instance, + android_webview.PermissionRequest request, + )? onPermissionRequest, + Future Function(String origin, + android_webview.GeolocationPermissionsCallback callback)? + onGeolocationPermissionsShowPrompt, + void Function(android_webview.WebChromeClient instance)? + onGeolocationPermissionsHidePrompt, + void Function( + android_webview.WebChromeClient instance, + android_webview.View view, + android_webview.CustomViewCallback callback)? + onShowCustomView, + void Function(android_webview.WebChromeClient instance)? onHideCustomView, + }) createAndroidWebChromeClient; /// Constructs a [android_webview.WebViewClient]. final android_webview.WebViewClient Function({ diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart index 8759f424ca4c..5ed2fc0351ef 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart @@ -1024,6 +1024,18 @@ typedef GeolocationPermissionsHidePrompt = void Function( WebChromeClient instance, ); +/// Signature for the callback that is responsible for showing a custom view. +typedef ShowCustomViewCallback = void Function( + WebChromeClient instance, + View view, + CustomViewCallback callback, +); + +/// Signature for the callback that is responsible for hiding a custom view. +typedef HideCustomViewCallback = void Function( + WebChromeClient instance, +); + /// Handles JavaScript dialogs, favicons, titles, and the progress for [WebView]. class WebChromeClient extends JavaObject { /// Constructs a [WebChromeClient]. @@ -1031,13 +1043,10 @@ class WebChromeClient extends JavaObject { this.onProgressChanged, this.onShowFileChooser, this.onPermissionRequest, -<<<<<<< HEAD - this.onShowCustomView, - this.onHideCustomView, -======= this.onGeolocationPermissionsShowPrompt, this.onGeolocationPermissionsHidePrompt, ->>>>>>> origin/main + this.onShowCustomView, + this.onHideCustomView, @visibleForTesting super.binaryMessenger, @visibleForTesting super.instanceManager, }) : super.detached() { @@ -1055,13 +1064,10 @@ class WebChromeClient extends JavaObject { this.onProgressChanged, this.onShowFileChooser, this.onPermissionRequest, -<<<<<<< HEAD - this.onShowCustomView, - this.onHideCustomView, -======= this.onGeolocationPermissionsShowPrompt, this.onGeolocationPermissionsHidePrompt, ->>>>>>> origin/main + this.onShowCustomView, + this.onHideCustomView, super.binaryMessenger, super.instanceManager, }) : super.detached(); @@ -1096,32 +1102,24 @@ class WebChromeClient extends JavaObject { PermissionRequest request, )? onPermissionRequest; -<<<<<<< HEAD + /// Indicates the client should handle geolocation permissions. + final GeolocationPermissionsShowPrompt? onGeolocationPermissionsShowPrompt; + + /// Notify the host application that a request for Geolocation permissions, + /// made with a previous call to [onGeolocationPermissionsShowPrompt] has been + /// canceled. + final GeolocationPermissionsHidePrompt? onGeolocationPermissionsHidePrompt; + /// Notify the host application that the current page has entered full screen /// mode. /// /// After this call, web content will no longer be rendered in the WebView, /// but will instead be rendered in `view`. - final void Function( - WebChromeClient instance, - View view, - CustomViewCallback callback, - )? onShowCustomView; + final ShowCustomViewCallback? onShowCustomView; /// Notify the host application that the current page has exited full screen /// mode. - final void Function(WebChromeClient instance)? onHideCustomView; -======= - /// Indicates the client should handle geolocation permissions. - final GeolocationPermissionsShowPrompt? onGeolocationPermissionsShowPrompt; - - /// Notify the host application that a request for Geolocation permissions, - /// made with a previous call to [onGeolocationPermissionsShowPrompt] has been - /// canceled. - final void Function( - WebChromeClient instance, - )? onGeolocationPermissionsHidePrompt; ->>>>>>> origin/main + final HideCustomViewCallback? onHideCustomView; /// Sets the required synchronous return value for the Java method, /// `WebChromeClient.onShowFileChooser(...)`. @@ -1157,14 +1155,11 @@ class WebChromeClient extends JavaObject { return WebChromeClient.detached( onProgressChanged: onProgressChanged, onShowFileChooser: onShowFileChooser, -<<<<<<< HEAD onPermissionRequest: onPermissionRequest, - onShowCustomView: onShowCustomView, - onHideCustomView: onHideCustomView, -======= onGeolocationPermissionsShowPrompt: onGeolocationPermissionsShowPrompt, onGeolocationPermissionsHidePrompt: onGeolocationPermissionsHidePrompt, ->>>>>>> origin/main + onShowCustomView: onShowCustomView, + onHideCustomView: onHideCustomView, binaryMessenger: _api.binaryMessenger, instanceManager: _api.instanceManager, ); diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart index 70473bfc13cf..2a83332f479f 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart @@ -20,12 +20,10 @@ enum FileChooserMode { /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN. open, - /// Similar to [open] but allows multiple files to be selected. /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE. openMultiple, - /// Allows picking a nonexistent file and saving it. /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE. @@ -94,8 +92,7 @@ class WebResourceRequestData { isRedirect: result[2] as bool?, hasGesture: result[3]! as bool, method: result[4]! as String, - requestHeaders: - (result[5] as Map?)!.cast(), + requestHeaders: (result[5] as Map?)!.cast(), ); } } @@ -170,7 +167,8 @@ class InstanceManagerHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.InstanceManagerHostApi.clear', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send(null) as List?; + final List? replyList = + await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -234,8 +232,7 @@ abstract class JavaObjectFlutterApi { void dispose(int identifier); - static void setup(JavaObjectFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(JavaObjectFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaObjectFlutterApi.dispose', codec, @@ -245,7 +242,7 @@ abstract class JavaObjectFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -297,13 +294,12 @@ class CookieManagerHostApi { } /// Handles Dart method `CookieManager.setCookie`. - Future setCookie( - int arg_identifier, String arg_url, String arg_value) async { + Future setCookie(int arg_identifier, String arg_url, String arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CookieManagerHostApi.setCookie', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_url, arg_value]) as List?; + final List? replyList = + await channel.send([arg_identifier, arg_url, arg_value]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -349,15 +345,12 @@ class CookieManagerHostApi { } /// Handles Dart method `CookieManager.setAcceptThirdPartyCookies`. - Future setAcceptThirdPartyCookies( - int arg_identifier, int arg_webViewIdentifier, bool arg_accept) async { + Future setAcceptThirdPartyCookies(int arg_identifier, int arg_webViewIdentifier, bool arg_accept) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies', - codec, + 'dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_identifier, arg_webViewIdentifier, arg_accept]) - as List?; + final List? replyList = + await channel.send([arg_identifier, arg_webViewIdentifier, arg_accept]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -377,7 +370,6 @@ class CookieManagerHostApi { class _WebViewHostApiCodec extends StandardMessageCodec { const _WebViewHostApiCodec(); - @override void writeValue(WriteBuffer buffer, Object? value) { if (value is WebViewPoint) { @@ -391,7 +383,7 @@ class _WebViewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebViewPoint.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -431,14 +423,12 @@ class WebViewHostApi { } } - Future loadData(int arg_instanceId, String arg_data, - String? arg_mimeType, String? arg_encoding) async { + Future loadData(int arg_instanceId, String arg_data, String? arg_mimeType, String? arg_encoding) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.loadData', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send( - [arg_instanceId, arg_data, arg_mimeType, arg_encoding]) - as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_data, arg_mimeType, arg_encoding]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -455,24 +445,12 @@ class WebViewHostApi { } } - Future loadDataWithBaseUrl( - int arg_instanceId, - String? arg_baseUrl, - String arg_data, - String? arg_mimeType, - String? arg_encoding, - String? arg_historyUrl) async { + Future loadDataWithBaseUrl(int arg_instanceId, String? arg_baseUrl, String arg_data, String? arg_mimeType, String? arg_encoding, String? arg_historyUrl) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel.send([ - arg_instanceId, - arg_baseUrl, - arg_data, - arg_mimeType, - arg_encoding, - arg_historyUrl - ]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_baseUrl, arg_data, arg_mimeType, arg_encoding, arg_historyUrl]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -489,14 +467,12 @@ class WebViewHostApi { } } - Future loadUrl(int arg_instanceId, String arg_url, - Map arg_headers) async { + Future loadUrl(int arg_instanceId, String arg_url, Map arg_headers) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.loadUrl', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_url, arg_headers]) - as List?; + await channel.send([arg_instanceId, arg_url, arg_headers]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -513,13 +489,12 @@ class WebViewHostApi { } } - Future postUrl( - int arg_instanceId, String arg_url, Uint8List arg_data) async { + Future postUrl(int arg_instanceId, String arg_url, Uint8List arg_data) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.postUrl', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_url, arg_data]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_url, arg_data]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -683,8 +658,7 @@ class WebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.clearCache', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_includeDiskFiles]) - as List?; + await channel.send([arg_instanceId, arg_includeDiskFiles]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -701,14 +675,12 @@ class WebViewHostApi { } } - Future evaluateJavascript( - int arg_instanceId, String arg_javascriptString) async { + Future evaluateJavascript(int arg_instanceId, String arg_javascriptString) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.evaluateJavascript', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_javascriptString]) - as List?; + await channel.send([arg_instanceId, arg_javascriptString]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -751,8 +723,8 @@ class WebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.scrollTo', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_x, arg_y]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_x, arg_y]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -773,8 +745,8 @@ class WebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.scrollBy', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_x, arg_y]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_x, arg_y]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -874,8 +846,7 @@ class WebViewHostApi { Future setWebContentsDebuggingEnabled(bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', - codec, + 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_enabled]) as List?; @@ -895,14 +866,12 @@ class WebViewHostApi { } } - Future setWebViewClient( - int arg_instanceId, int arg_webViewClientInstanceId) async { + Future setWebViewClient(int arg_instanceId, int arg_webViewClientInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setWebViewClient', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_webViewClientInstanceId]) - as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_webViewClientInstanceId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -919,14 +888,12 @@ class WebViewHostApi { } } - Future addJavaScriptChannel( - int arg_instanceId, int arg_javaScriptChannelInstanceId) async { + Future addJavaScriptChannel(int arg_instanceId, int arg_javaScriptChannelInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_javaScriptChannelInstanceId]) - as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_javaScriptChannelInstanceId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -943,14 +910,12 @@ class WebViewHostApi { } } - Future removeJavaScriptChannel( - int arg_instanceId, int arg_javaScriptChannelInstanceId) async { + Future removeJavaScriptChannel(int arg_instanceId, int arg_javaScriptChannelInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_javaScriptChannelInstanceId]) - as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_javaScriptChannelInstanceId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -967,14 +932,12 @@ class WebViewHostApi { } } - Future setDownloadListener( - int arg_instanceId, int? arg_listenerInstanceId) async { + Future setDownloadListener(int arg_instanceId, int? arg_listenerInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setDownloadListener', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_listenerInstanceId]) - as List?; + await channel.send([arg_instanceId, arg_listenerInstanceId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -991,14 +954,12 @@ class WebViewHostApi { } } - Future setWebChromeClient( - int arg_instanceId, int? arg_clientInstanceId) async { + Future setWebChromeClient(int arg_instanceId, int? arg_clientInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setWebChromeClient', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_clientInstanceId]) - as List?; + await channel.send([arg_instanceId, arg_clientInstanceId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1019,8 +980,8 @@ class WebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setBackgroundColor', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_color]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_color]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1051,8 +1012,7 @@ abstract class WebViewFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int identifier); - static void setup(WebViewFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(WebViewFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewFlutterApi.create', codec, @@ -1062,7 +1022,7 @@ abstract class WebViewFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebViewFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1090,8 +1050,7 @@ class WebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.create', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_webViewInstanceId]) - as List?; + await channel.send([arg_instanceId, arg_webViewInstanceId]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1112,8 +1071,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_flag]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_flag]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1130,14 +1089,12 @@ class WebSettingsHostApi { } } - Future setJavaScriptCanOpenWindowsAutomatically( - int arg_instanceId, bool arg_flag) async { + Future setJavaScriptCanOpenWindowsAutomatically(int arg_instanceId, bool arg_flag) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_flag]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_flag]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1154,14 +1111,12 @@ class WebSettingsHostApi { } } - Future setSupportMultipleWindows( - int arg_instanceId, bool arg_support) async { + Future setSupportMultipleWindows(int arg_instanceId, bool arg_support) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_support]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_support]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1182,8 +1137,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_flag]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_flag]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1200,13 +1155,12 @@ class WebSettingsHostApi { } } - Future setUserAgentString( - int arg_instanceId, String? arg_userAgentString) async { + Future setUserAgentString(int arg_instanceId, String? arg_userAgentString) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_userAgentString]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_userAgentString]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1223,14 +1177,12 @@ class WebSettingsHostApi { } } - Future setMediaPlaybackRequiresUserGesture( - int arg_instanceId, bool arg_require) async { + Future setMediaPlaybackRequiresUserGesture(int arg_instanceId, bool arg_require) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_require]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_require]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1251,8 +1203,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_support]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_support]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1269,13 +1221,12 @@ class WebSettingsHostApi { } } - Future setLoadWithOverviewMode( - int arg_instanceId, bool arg_overview) async { + Future setLoadWithOverviewMode(int arg_instanceId, bool arg_overview) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_overview]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_overview]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1296,8 +1247,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_use]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_use]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1314,13 +1265,12 @@ class WebSettingsHostApi { } } - Future setDisplayZoomControls( - int arg_instanceId, bool arg_enabled) async { + Future setDisplayZoomControls(int arg_instanceId, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_enabled]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1337,13 +1287,12 @@ class WebSettingsHostApi { } } - Future setBuiltInZoomControls( - int arg_instanceId, bool arg_enabled) async { + Future setBuiltInZoomControls(int arg_instanceId, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_enabled]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1364,8 +1313,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_enabled]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1386,8 +1335,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setTextZoom', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_textZoom]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_textZoom]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1419,8 +1368,8 @@ class JavaScriptChannelHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_channelName]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_channelName]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1443,8 +1392,7 @@ abstract class JavaScriptChannelFlutterApi { void postMessage(int instanceId, String message); - static void setup(JavaScriptChannelFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(JavaScriptChannelFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage', codec, @@ -1454,7 +1402,7 @@ abstract class JavaScriptChannelFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage was null.'); + 'Argument for dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1502,14 +1450,12 @@ class WebViewClientHostApi { } } - Future setSynchronousReturnValueForShouldOverrideUrlLoading( - int arg_instanceId, bool arg_value) async { + Future setSynchronousReturnValueForShouldOverrideUrlLoading(int arg_instanceId, bool arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', - codec, + 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_value]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_value]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1529,7 +1475,6 @@ class WebViewClientHostApi { class _WebViewClientFlutterApiCodec extends StandardMessageCodec { const _WebViewClientFlutterApiCodec(); - @override void writeValue(WriteBuffer buffer, Object? value) { if (value is WebResourceErrorData) { @@ -1546,9 +1491,9 @@ class _WebViewClientFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebResourceErrorData.decode(readValue(buffer)!); - case 129: + case 129: return WebResourceRequestData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1563,22 +1508,17 @@ abstract class WebViewClientFlutterApi { void onPageFinished(int instanceId, int webViewInstanceId, String url); - void onReceivedRequestError(int instanceId, int webViewInstanceId, - WebResourceRequestData request, WebResourceErrorData error); + void onReceivedRequestError(int instanceId, int webViewInstanceId, WebResourceRequestData request, WebResourceErrorData error); - void onReceivedError(int instanceId, int webViewInstanceId, int errorCode, - String description, String failingUrl); + void onReceivedError(int instanceId, int webViewInstanceId, int errorCode, String description, String failingUrl); - void requestLoading( - int instanceId, int webViewInstanceId, WebResourceRequestData request); + void requestLoading(int instanceId, int webViewInstanceId, WebResourceRequestData request); void urlLoading(int instanceId, int webViewInstanceId, String url); - void doUpdateVisitedHistory( - int instanceId, int webViewInstanceId, String url, bool isReload); + void doUpdateVisitedHistory(int instanceId, int webViewInstanceId, String url, bool isReload); - static void setup(WebViewClientFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(WebViewClientFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted', codec, @@ -1588,7 +1528,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1613,7 +1553,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1631,15 +1571,14 @@ abstract class WebViewClientFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError', - codec, + 'dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1647,16 +1586,13 @@ abstract class WebViewClientFlutterApi { final int? arg_webViewInstanceId = (args[1] as int?); assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null int.'); - final WebResourceRequestData? arg_request = - (args[2] as WebResourceRequestData?); + final WebResourceRequestData? arg_request = (args[2] as WebResourceRequestData?); assert(arg_request != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null WebResourceRequestData.'); - final WebResourceErrorData? arg_error = - (args[3] as WebResourceErrorData?); + final WebResourceErrorData? arg_error = (args[3] as WebResourceErrorData?); assert(arg_error != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null WebResourceErrorData.'); - api.onReceivedRequestError(arg_instanceId!, arg_webViewInstanceId!, - arg_request!, arg_error!); + api.onReceivedRequestError(arg_instanceId!, arg_webViewInstanceId!, arg_request!, arg_error!); return; }); } @@ -1670,7 +1606,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1687,8 +1623,7 @@ abstract class WebViewClientFlutterApi { final String? arg_failingUrl = (args[4] as String?); assert(arg_failingUrl != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null String.'); - api.onReceivedError(arg_instanceId!, arg_webViewInstanceId!, - arg_errorCode!, arg_description!, arg_failingUrl!); + api.onReceivedError(arg_instanceId!, arg_webViewInstanceId!, arg_errorCode!, arg_description!, arg_failingUrl!); return; }); } @@ -1702,7 +1637,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1710,12 +1645,10 @@ abstract class WebViewClientFlutterApi { final int? arg_webViewInstanceId = (args[1] as int?); assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null, expected non-null int.'); - final WebResourceRequestData? arg_request = - (args[2] as WebResourceRequestData?); + final WebResourceRequestData? arg_request = (args[2] as WebResourceRequestData?); assert(arg_request != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null, expected non-null WebResourceRequestData.'); - api.requestLoading( - arg_instanceId!, arg_webViewInstanceId!, arg_request!); + api.requestLoading(arg_instanceId!, arg_webViewInstanceId!, arg_request!); return; }); } @@ -1729,7 +1662,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1747,15 +1680,14 @@ abstract class WebViewClientFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory', - codec, + 'dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1769,8 +1701,7 @@ abstract class WebViewClientFlutterApi { final bool? arg_isReload = (args[3] as bool?); assert(arg_isReload != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null, expected non-null bool.'); - api.doUpdateVisitedHistory( - arg_instanceId!, arg_webViewInstanceId!, arg_url!, arg_isReload!); + api.doUpdateVisitedHistory(arg_instanceId!, arg_webViewInstanceId!, arg_url!, arg_isReload!); return; }); } @@ -1814,22 +1745,19 @@ class DownloadListenerHostApi { abstract class DownloadListenerFlutterApi { static const MessageCodec codec = StandardMessageCodec(); - void onDownloadStart(int instanceId, String url, String userAgent, - String contentDisposition, String mimetype, int contentLength); + void onDownloadStart(int instanceId, String url, String userAgent, String contentDisposition, String mimetype, int contentLength); - static void setup(DownloadListenerFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(DownloadListenerFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart', - codec, + 'dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null.'); + 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1849,8 +1777,7 @@ abstract class DownloadListenerFlutterApi { final int? arg_contentLength = (args[5] as int?); assert(arg_contentLength != null, 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null int.'); - api.onDownloadStart(arg_instanceId!, arg_url!, arg_userAgent!, - arg_contentDisposition!, arg_mimetype!, arg_contentLength!); + api.onDownloadStart(arg_instanceId!, arg_url!, arg_userAgent!, arg_contentDisposition!, arg_mimetype!, arg_contentLength!); return; }); } @@ -1890,14 +1817,12 @@ class WebChromeClientHostApi { } } - Future setSynchronousReturnValueForOnShowFileChooser( - int arg_instanceId, bool arg_value) async { + Future setSynchronousReturnValueForOnShowFileChooser(int arg_instanceId, bool arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', - codec, + 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_value]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_value]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1954,8 +1879,7 @@ class FlutterAssetManagerHostApi { Future getAssetFilePathByName(String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', - codec, + 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_name]) as List?; @@ -1986,32 +1910,34 @@ abstract class WebChromeClientFlutterApi { void onProgressChanged(int instanceId, int webViewInstanceId, int progress); - Future> onShowFileChooser( - int instanceId, int webViewInstanceId, int paramsInstanceId); + Future> onShowFileChooser(int instanceId, int webViewInstanceId, int paramsInstanceId); /// Callback to Dart function `WebChromeClient.onPermissionRequest`. void onPermissionRequest(int instanceId, int requestInstanceId); + /// Callback to Dart function `WebChromeClient.onShowCustomView`. + void onShowCustomView(int instanceId, int viewIdentifier, int callbackIdentifier); + + /// Callback to Dart function `WebChromeClient.onHideCustomView`. + void onHideCustomView(int instanceId); + /// Callback to Dart function `WebChromeClient.onGeolocationPermissionsShowPrompt`. - void onGeolocationPermissionsShowPrompt( - int instanceId, int paramsInstanceId, String origin); + void onGeolocationPermissionsShowPrompt(int instanceId, int paramsInstanceId, String origin); /// Callback to Dart function `WebChromeClient.onGeolocationPermissionsHidePrompt`. void onGeolocationPermissionsHidePrompt(int identifier); - static void setup(WebChromeClientFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(WebChromeClientFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged', - codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -2022,23 +1948,21 @@ abstract class WebChromeClientFlutterApi { final int? arg_progress = (args[2] as int?); assert(arg_progress != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null, expected non-null int.'); - api.onProgressChanged( - arg_instanceId!, arg_webViewInstanceId!, arg_progress!); + api.onProgressChanged(arg_instanceId!, arg_webViewInstanceId!, arg_progress!); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser', - codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -2049,23 +1973,21 @@ abstract class WebChromeClientFlutterApi { final int? arg_paramsInstanceId = (args[2] as int?); assert(arg_paramsInstanceId != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null, expected non-null int.'); - final List output = await api.onShowFileChooser( - arg_instanceId!, arg_webViewInstanceId!, arg_paramsInstanceId!); + final List output = await api.onShowFileChooser(arg_instanceId!, arg_webViewInstanceId!, arg_paramsInstanceId!); return output; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest', - codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -2080,15 +2002,58 @@ abstract class WebChromeClientFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsShowPrompt', - codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsShowPrompt was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView was null, expected non-null int.'); + final int? arg_viewIdentifier = (args[1] as int?); + assert(arg_viewIdentifier != null, + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView was null, expected non-null int.'); + final int? arg_callbackIdentifier = (args[2] as int?); + assert(arg_callbackIdentifier != null, + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView was null, expected non-null int.'); + api.onShowCustomView(arg_instanceId!, arg_viewIdentifier!, arg_callbackIdentifier!); + return; + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onHideCustomView', codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onHideCustomView was null.'); + final List args = (message as List?)!; + final int? arg_instanceId = (args[0] as int?); + assert(arg_instanceId != null, + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onHideCustomView was null, expected non-null int.'); + api.onHideCustomView(arg_instanceId!); + return; + }); + } + } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsShowPrompt', codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsShowPrompt was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -2099,23 +2064,21 @@ abstract class WebChromeClientFlutterApi { final String? arg_origin = (args[2] as String?); assert(arg_origin != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsShowPrompt was null, expected non-null String.'); - api.onGeolocationPermissionsShowPrompt( - arg_instanceId!, arg_paramsInstanceId!, arg_origin!); + api.onGeolocationPermissionsShowPrompt(arg_instanceId!, arg_paramsInstanceId!, arg_origin!); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsHidePrompt', - codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsHidePrompt', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsHidePrompt was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsHidePrompt was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2185,7 +2148,6 @@ class WebStorageHostApi { class _FileChooserParamsFlutterApiCodec extends StandardMessageCodec { const _FileChooserParamsFlutterApiCodec(); - @override void writeValue(WriteBuffer buffer, Object? value) { if (value is FileChooserModeEnumData) { @@ -2199,7 +2161,7 @@ class _FileChooserParamsFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return FileChooserModeEnumData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -2211,14 +2173,11 @@ class _FileChooserParamsFlutterApiCodec extends StandardMessageCodec { /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. abstract class FileChooserParamsFlutterApi { - static const MessageCodec codec = - _FileChooserParamsFlutterApiCodec(); + static const MessageCodec codec = _FileChooserParamsFlutterApiCodec(); - void create(int instanceId, bool isCaptureEnabled, List acceptTypes, - FileChooserModeEnumData mode, String? filenameHint); + void create(int instanceId, bool isCaptureEnabled, List acceptTypes, FileChooserModeEnumData mode, String? filenameHint); - static void setup(FileChooserParamsFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(FileChooserParamsFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FileChooserParamsFlutterApi.create', codec, @@ -2228,7 +2187,7 @@ abstract class FileChooserParamsFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -2236,17 +2195,14 @@ abstract class FileChooserParamsFlutterApi { final bool? arg_isCaptureEnabled = (args[1] as bool?); assert(arg_isCaptureEnabled != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null bool.'); - final List? arg_acceptTypes = - (args[2] as List?)?.cast(); + final List? arg_acceptTypes = (args[2] as List?)?.cast(); assert(arg_acceptTypes != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null List.'); - final FileChooserModeEnumData? arg_mode = - (args[3] as FileChooserModeEnumData?); + final FileChooserModeEnumData? arg_mode = (args[3] as FileChooserModeEnumData?); assert(arg_mode != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null FileChooserModeEnumData.'); final String? arg_filenameHint = (args[4] as String?); - api.create(arg_instanceId!, arg_isCaptureEnabled!, arg_acceptTypes!, - arg_mode!, arg_filenameHint); + api.create(arg_instanceId!, arg_isCaptureEnabled!, arg_acceptTypes!, arg_mode!, arg_filenameHint); return; }); } @@ -2276,8 +2232,8 @@ class PermissionRequestHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PermissionRequestHostApi.grant', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_resources]) as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_resources]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2331,8 +2287,7 @@ abstract class PermissionRequestFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int instanceId, List resources); - static void setup(PermissionRequestFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(PermissionRequestFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PermissionRequestFlutterApi.create', codec, @@ -2342,13 +2297,12 @@ abstract class PermissionRequestFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PermissionRequestFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.PermissionRequestFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.PermissionRequestFlutterApi.create was null, expected non-null int.'); - final List? arg_resources = - (args[1] as List?)?.cast(); + final List? arg_resources = (args[1] as List?)?.cast(); assert(arg_resources != null, 'Argument for dev.flutter.pigeon.PermissionRequestFlutterApi.create was null, expected non-null List.'); api.create(arg_instanceId!, arg_resources!); @@ -2359,6 +2313,119 @@ abstract class PermissionRequestFlutterApi { } } +/// Host API for `CustomViewCallback`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +/// +/// See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. +class CustomViewCallbackHostApi { + /// Constructor for [CustomViewCallbackHostApi]. The [binaryMessenger] named argument is + /// available for dependency injection. If it is left null, the default + /// BinaryMessenger will be used which routes to the host platform. + CustomViewCallbackHostApi({BinaryMessenger? binaryMessenger}) + : _binaryMessenger = binaryMessenger; + final BinaryMessenger? _binaryMessenger; + + static const MessageCodec codec = StandardMessageCodec(); + + /// Handles Dart method `CustomViewCallback.onCustomViewHidden`. + Future onCustomViewHidden(int arg_identifier) async { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden', codec, + binaryMessenger: _binaryMessenger); + final List? replyList = + await channel.send([arg_identifier]) as List?; + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel.', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else { + return; + } + } +} + +/// Flutter API for `CustomViewCallback`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. +abstract class CustomViewCallbackFlutterApi { + static const MessageCodec codec = StandardMessageCodec(); + + /// Create a new Dart instance and add it to the `InstanceManager`. + void create(int identifier); + + static void setup(CustomViewCallbackFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.CustomViewCallbackFlutterApi.create', codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.CustomViewCallbackFlutterApi.create was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.CustomViewCallbackFlutterApi.create was null, expected non-null int.'); + api.create(arg_identifier!); + return; + }); + } + } + } +} + +/// Flutter API for `View`. +/// +/// This class may handle instantiating and adding Dart instances that are +/// attached to a native instance or receiving callback methods from an +/// overridden native class. +/// +/// See https://developer.android.com/reference/android/view/View. +abstract class ViewFlutterApi { + static const MessageCodec codec = StandardMessageCodec(); + + /// Create a new Dart instance and add it to the `InstanceManager`. + void create(int identifier); + + static void setup(ViewFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.ViewFlutterApi.create', codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.ViewFlutterApi.create was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.ViewFlutterApi.create was null, expected non-null int.'); + api.create(arg_identifier!); + return; + }); + } + } + } +} + /// Host API for `GeolocationPermissionsCallback`. /// /// This class may handle instantiating and adding native object instances that @@ -2377,15 +2444,12 @@ class GeolocationPermissionsCallbackHostApi { static const MessageCodec codec = StandardMessageCodec(); /// Handles Dart method `GeolocationPermissionsCallback.invoke`. - Future invoke(int arg_instanceId, String arg_origin, bool arg_allow, - bool arg_retain) async { + Future invoke(int arg_instanceId, String arg_origin, bool arg_allow, bool arg_retain) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.GeolocationPermissionsCallbackHostApi.invoke', - codec, + 'dev.flutter.pigeon.GeolocationPermissionsCallbackHostApi.invoke', codec, binaryMessenger: _binaryMessenger); - final List? replyList = await channel - .send([arg_instanceId, arg_origin, arg_allow, arg_retain]) - as List?; + final List? replyList = + await channel.send([arg_instanceId, arg_origin, arg_allow, arg_retain]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2416,19 +2480,17 @@ abstract class GeolocationPermissionsCallbackFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int instanceId); - static void setup(GeolocationPermissionsCallbackFlutterApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(GeolocationPermissionsCallbackFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.GeolocationPermissionsCallbackFlutterApi.create', - codec, + 'dev.flutter.pigeon.GeolocationPermissionsCallbackFlutterApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.GeolocationPermissionsCallbackFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.GeolocationPermissionsCallbackFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart index 151cc81b8237..74a8d4aef109 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart @@ -4,6 +4,8 @@ import 'dart:async'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; @@ -137,6 +139,42 @@ class AndroidWebViewController extends PlatformWebViewController { } }; }), + onShowCustomView: withWeakReferenceTo(this, + (WeakReference weakReference) { + return (_, android_webview.View view, + android_webview.CustomViewCallback callback) { + final AndroidWebViewController? webViewController = + weakReference.target; + if (webViewController == null) { + callback.onCustomViewHidden(); + return; + } + final OnShowCustomViewCallback? onShowCallback = + webViewController._onShowCustomViewCallback; + if (onShowCallback == null) { + callback.onCustomViewHidden(); + return; + } + final AndroidCustomViewWidgetCreationParams creationParams = + AndroidCustomViewWidgetCreationParams( + controller: webViewController, customView: view); + + onShowCallback( + AndroidCustomViewWidget.private(creationParams: creationParams), + () => callback.onCustomViewHidden(), + ); + }; + }), + onHideCustomView: withWeakReferenceTo(this, + (WeakReference weakReference) { + return (android_webview.WebChromeClient instance) { + final OnHideCustomViewCallback? onHideCustomViewCallback = + weakReference.target?._onHideCustomViewCallback; + if (onHideCustomViewCallback != null) { + onHideCustomViewCallback(); + } + }; + }), onShowFileChooser: withWeakReferenceTo( this, (WeakReference weakReference) { @@ -212,6 +250,10 @@ class AndroidWebViewController extends PlatformWebViewController { OnGeolocationPermissionsHidePrompt? _onGeolocationPermissionsHidePrompt; + OnShowCustomViewCallback? _onShowCustomViewCallback; + + OnHideCustomViewCallback? _onHideCustomViewCallback; + void Function(PlatformWebViewPermissionRequest)? _onPermissionRequestCallback; /// Whether to enable the platform's webview content debugging tools. @@ -493,6 +535,25 @@ class AndroidWebViewController extends PlatformWebViewController { _onGeolocationPermissionsShowPrompt = onShowPrompt; _onGeolocationPermissionsHidePrompt = onHidePrompt; } + + /// Sets the callbacks that are invoked when the host application wants to + /// show or hide a custom view. + /// + /// The most common use case these methods are invoked a video element wants + /// to be displayed in fullscreen. + /// + /// The [onShowCustomView] notifies the host application that web content + /// from the specified origin wants to be displayed in a custom view. + /// + /// The [onHideCustomView] notifies the host application that the custom + /// view should be hidden. + Future setCustomViewCallbacks({ + OnShowCustomViewCallback? onShowCustomView, + OnHideCustomViewCallback? onHideCustomView, + }) async { + _onShowCustomViewCallback = onShowCustomView; + _onHideCustomViewCallback = onHideCustomView; + } } /// Android implementation of [PlatformWebViewPermissionRequest]. @@ -539,6 +600,13 @@ typedef OnGeolocationPermissionsShowPrompt /// Signature for the `setGeolocationPermissionsPromptCallbacks` callback responsible for request the Geolocation API is cancel. typedef OnGeolocationPermissionsHidePrompt = void Function(); +/// Signature for the `setCustomViewCallbacks` callback responsible for showing the custom view. +typedef OnShowCustomViewCallback = void Function( + AndroidCustomViewWidget view, void Function() onCustomViewHidden); + +/// Signature for the `setCustomViewCallbacks` callback responsible for hiding the custom view. +typedef OnHideCustomViewCallback = void Function(); + /// A request params used by the host application to set the Geolocation permission state for an origin. @immutable class GeolocationPermissionsRequestParams { @@ -778,36 +846,166 @@ class AndroidWebViewWidget extends PlatformWebViewWidget { params, displayWithHybridComposition: _androidParams.displayWithHybridComposition, + platformViewsServiceProxy: _androidParams.platformViewsServiceProxy, + view: + (_androidParams.controller as AndroidWebViewController)._webView, + instanceManager: _androidParams.instanceManager, + layoutDirection: _androidParams.layoutDirection, ) ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated) ..create(); }, ); } +} - AndroidViewController _initAndroidView( - PlatformViewCreationParams params, { - required bool displayWithHybridComposition, - }) { - if (displayWithHybridComposition) { - return _androidParams.platformViewsServiceProxy.initExpensiveAndroidView( - id: params.id, - viewType: 'plugins.flutter.io/webview', - layoutDirection: _androidParams.layoutDirection, - creationParams: _androidParams.instanceManager.getIdentifier( - (_androidParams.controller as AndroidWebViewController)._webView), - creationParamsCodec: const StandardMessageCodec(), - ); - } else { - return _androidParams.platformViewsServiceProxy.initSurfaceAndroidView( - id: params.id, - viewType: 'plugins.flutter.io/webview', - layoutDirection: _androidParams.layoutDirection, - creationParams: _androidParams.instanceManager.getIdentifier( - (_androidParams.controller as AndroidWebViewController)._webView), - creationParamsCodec: const StandardMessageCodec(), - ); - } +/// Object specifying creation parameters for creating a [AndroidCustomViewWidget]. +/// +/// When adding additional fields make sure they can be null or have a default +/// value to avoid breaking changes. +@immutable +class AndroidCustomViewWidgetCreationParams { + /// Creates [AndroidCustomViewWidgetCreationParams]. + AndroidCustomViewWidgetCreationParams({ + required this.controller, + required this.customView, + this.layoutDirection = TextDirection.ltr, + this.gestureRecognizers = const >{}, + this.displayWithHybridComposition = false, + @visibleForTesting InstanceManager? instanceManager, + @visibleForTesting + this.platformViewsServiceProxy = const PlatformViewsServiceProxy(), + }) : instanceManager = + instanceManager ?? android_webview.JavaObject.globalInstanceManager; + + /// The reference to the Android native view that should be shown. + final android_webview.View customView; + + /// The [PlatformWebViewController] that allows controlling the native web + /// view. + final PlatformWebViewController controller; + + /// The layout direction to use for the embedded WebView. + final TextDirection layoutDirection; + + /// The `gestureRecognizers` specifies which gestures should be consumed by the + /// web view. + /// + /// It is possible for other gesture recognizers to be competing with the web + /// view on pointer events, e.g. if the web view is inside a [ListView] the + /// [ListView] will want to handle vertical drags. The web view will claim + /// gestures that are recognized by any of the recognizers on this list. + /// + /// When `gestureRecognizers` is empty (default), the web view will only handle + /// pointer events for gestures that were not claimed by any other gesture + /// recognizer. + final Set> gestureRecognizers; + + /// Maintains instances used to communicate with the native objects they + /// represent. + /// + /// This field is exposed for testing purposes only and should not be used + /// outside of tests. + @visibleForTesting + final InstanceManager instanceManager; + + /// Proxy that provides access to the platform views service. + /// + /// This service allows creating and controlling platform-specific views. + @visibleForTesting + final PlatformViewsServiceProxy platformViewsServiceProxy; + + /// Whether the [WebView] will be displayed using the Hybrid Composition + /// PlatformView implementation. + /// + /// For most use cases, this flag should be set to false. Hybrid Composition + /// can have performance costs but doesn't have the limitation of rendering to + /// an Android SurfaceTexture. See + /// * https://flutter.dev/docs/development/platform-integration/platform-views#performance + /// * https://github.com/flutter/flutter/issues/104889 + /// * https://github.com/flutter/flutter/issues/116954 + /// + /// Defaults to false. + final bool displayWithHybridComposition; +} + +/// Represents a Flutter implementation of the Android [View](https://developer.android.com/reference/android/view/View) +/// that is created by the host platform when web content needs to be displayed +/// in fullscreen mode. +/// +/// The [AndroidCustomViewWidget] cannot be manually instantiated and is +/// provided to the host application through the callbacks specified using the +/// [AndroidWebViewController.setCustomViewCallbacks] method. +class AndroidCustomViewWidget extends StatelessWidget { + /// Creates a [AndroidCustomViewWidget]. + /// + /// The [AndroidCustomViewWidget] should only be instantiated internally. + /// This constructor is visible for testing purposes only and should + /// never be called externally. + @visibleForTesting + const AndroidCustomViewWidget.private({ + super.key, + required AndroidCustomViewWidgetCreationParams creationParams, + }) : _creationParams = creationParams; + + final AndroidCustomViewWidgetCreationParams _creationParams; + + @override + Widget build(BuildContext context) { + return PlatformViewLink( + key: key, + viewType: 'plugins.flutter.io/webview', + surfaceFactory: ( + BuildContext context, + PlatformViewController controller, + ) { + return AndroidViewSurface( + controller: controller as AndroidViewController, + hitTestBehavior: PlatformViewHitTestBehavior.opaque, + gestureRecognizers: _creationParams.gestureRecognizers, + ); + }, + onCreatePlatformView: (PlatformViewCreationParams params) { + return _initAndroidView( + params, + displayWithHybridComposition: + _creationParams.displayWithHybridComposition, + platformViewsServiceProxy: _creationParams.platformViewsServiceProxy, + view: _creationParams.customView, + instanceManager: _creationParams.instanceManager, + layoutDirection: _creationParams.layoutDirection, + ); + }, + ); + } +} + +AndroidViewController _initAndroidView( + PlatformViewCreationParams params, { + required bool displayWithHybridComposition, + required PlatformViewsServiceProxy platformViewsServiceProxy, + required android_webview.View view, + required InstanceManager instanceManager, + TextDirection layoutDirection = TextDirection.ltr, +}) { + final int? instanceId = instanceManager.getIdentifier(view); + + if (displayWithHybridComposition) { + return platformViewsServiceProxy.initExpensiveAndroidView( + id: params.id, + viewType: 'plugins.flutter.io/webview', + layoutDirection: layoutDirection, + creationParams: instanceId, + creationParamsCodec: const StandardMessageCodec(), + ); + } else { + return platformViewsServiceProxy.initSurfaceAndroidView( + id: params.id, + viewType: 'plugins.flutter.io/webview', + layoutDirection: layoutDirection, + creationParams: instanceId, + creationParamsCodec: const StandardMessageCodec(), + ); } } diff --git a/packages/webview_flutter/webview_flutter_android/lib/test b/packages/webview_flutter/webview_flutter_android/lib/test new file mode 100644 index 000000000000..5bc73c997256 --- /dev/null +++ b/packages/webview_flutter/webview_flutter_android/lib/test @@ -0,0 +1,1426 @@ +// 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/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:mockito/annotations.dart'; +import 'package:mockito/mockito.dart'; +import 'package:webview_flutter_android/src/android_proxy.dart'; +import 'package:webview_flutter_android/src/android_webview.dart' + as android_webview; +import 'package:webview_flutter_android/src/android_webview_api_impls.dart'; +import 'package:webview_flutter_android/src/instance_manager.dart'; +import 'package:webview_flutter_android/src/platform_views_service_proxy.dart'; +import 'package:webview_flutter_android/webview_flutter_android.dart'; +import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart'; + +import 'android_navigation_delegate_test.dart'; +import 'android_webview_controller_test.mocks.dart'; +import 'android_webview_test.mocks.dart' + show + MockTestGeolocationPermissionsCallbackHostApi, + MockTestCustomViewCallbackHostApi; +import 'test_android_webview.g.dart'; + +@GenerateNiceMocks(>[ + MockSpec(), + MockSpec(), + MockSpec(), + MockSpec(), + MockSpec(), + MockSpec(), + MockSpec(), + MockSpec(), + MockSpec(), + MockSpec(), + MockSpec(), + MockSpec(), + MockSpec(), + MockSpec(), + MockSpec(), + MockSpec(), + MockSpec(), +]) +void main() { + TestWidgetsFlutterBinding.ensureInitialized(); + + // Mocks the call to clear the native InstanceManager. + TestInstanceManagerHostApi.setup(MockTestInstanceManagerHostApi()); + + AndroidWebViewController createControllerWithMocks({ + android_webview.FlutterAssetManager? mockFlutterAssetManager, + android_webview.JavaScriptChannel? mockJavaScriptChannel, + android_webview.WebChromeClient Function({ + void Function(android_webview.WebView webView, int progress)? + onProgressChanged, + Future> Function( + android_webview.WebView webView, + android_webview.FileChooserParams params, + )? onShowFileChooser, + android_webview.GeolocationPermissionsShowPrompt? + onGeolocationPermissionsShowPrompt, + android_webview.GeolocationPermissionsHidePrompt? + onGeolocationPermissionsHidePrompt, + void Function( + android_webview.WebChromeClient instance, + android_webview.PermissionRequest request, + )? onPermissionRequest, + void Function( + android_webview.WebChromeClient instance, + android_webview.View view, + android_webview.CustomViewCallback callback)? + onShowCustomView, + void Function(android_webview.WebChromeClient instance)? onHideCustomView, + })? createWebChromeClient, + android_webview.WebView? mockWebView, + android_webview.WebViewClient? mockWebViewClient, + android_webview.WebStorage? mockWebStorage, + android_webview.WebSettings? mockSettings, + }) { + final android_webview.WebView nonNullMockWebView = + mockWebView ?? MockWebView(); + + final AndroidWebViewControllerCreationParams creationParams = + AndroidWebViewControllerCreationParams( + androidWebStorage: mockWebStorage ?? MockWebStorage(), + androidWebViewProxy: AndroidWebViewProxy( + createAndroidWebChromeClient: createWebChromeClient ?? + ({ + void Function(android_webview.WebView, int)? + onProgressChanged, + Future> Function( + android_webview.WebView webView, + android_webview.FileChooserParams params, + )? onShowFileChooser, + void Function( + android_webview.WebChromeClient instance, + android_webview.PermissionRequest request, + )? onPermissionRequest, + Future Function( + String origin, + android_webview.GeolocationPermissionsCallback callback, + )? onGeolocationPermissionsShowPrompt, + void Function(android_webview.WebChromeClient instance)? + onGeolocationPermissionsHidePrompt, + void Function( + android_webview.WebChromeClient instance, + android_webview.View view, + android_webview.CustomViewCallback callback)? + onShowCustomView, + void Function(android_webview.WebChromeClient instance)? + onHideCustomView, + }) => + MockWebChromeClient(), + createAndroidWebView: () => nonNullMockWebView, + createAndroidWebViewClient: ({ + void Function(android_webview.WebView webView, String url)? + onPageFinished, + void Function(android_webview.WebView webView, String url)? + onPageStarted, + @Deprecated('Only called on Android version < 23.') + void Function( + android_webview.WebView webView, + int errorCode, + String description, + String failingUrl, + )? onReceivedError, + void Function( + android_webview.WebView webView, + android_webview.WebResourceRequest request, + android_webview.WebResourceError error, + )? onReceivedRequestError, + void Function( + android_webview.WebView webView, + android_webview.WebResourceRequest request, + )? requestLoading, + void Function(android_webview.WebView webView, String url)? + urlLoading, + void Function( + android_webview.WebView webView, + String url, + bool isReload, + )? doUpdateVisitedHistory, + }) => + mockWebViewClient ?? MockWebViewClient(), + createFlutterAssetManager: () => + mockFlutterAssetManager ?? MockFlutterAssetManager(), + createJavaScriptChannel: ( + String channelName, { + required void Function(String) postMessage, + }) => + mockJavaScriptChannel ?? MockJavaScriptChannel(), + )); + + when(nonNullMockWebView.settings) + .thenReturn(mockSettings ?? MockWebSettings()); + + return AndroidWebViewController(creationParams); + } + + group('AndroidWebViewController', () { + AndroidJavaScriptChannelParams + createAndroidJavaScriptChannelParamsWithMocks({ + String? name, + MockJavaScriptChannel? mockJavaScriptChannel, + }) { + return AndroidJavaScriptChannelParams( + name: name ?? 'test', + onMessageReceived: (JavaScriptMessage message) {}, + webViewProxy: AndroidWebViewProxy( + createJavaScriptChannel: ( + String channelName, { + required void Function(String) postMessage, + }) => + mockJavaScriptChannel ?? MockJavaScriptChannel(), + )); + } + + test('loadFile without file prefix', () async { + final MockWebView mockWebView = MockWebView(); + final MockWebSettings mockWebSettings = MockWebSettings(); + createControllerWithMocks( + mockWebView: mockWebView, + mockSettings: mockWebSettings, + ); + + verify(mockWebSettings.setBuiltInZoomControls(true)).called(1); + verify(mockWebSettings.setDisplayZoomControls(false)).called(1); + verify(mockWebSettings.setDomStorageEnabled(true)).called(1); + verify(mockWebSettings.setJavaScriptCanOpenWindowsAutomatically(true)) + .called(1); + verify(mockWebSettings.setLoadWithOverviewMode(true)).called(1); + verify(mockWebSettings.setSupportMultipleWindows(true)).called(1); + verify(mockWebSettings.setUseWideViewPort(true)).called(1); + }); + + test('loadFile without file prefix', () async { + final MockWebView mockWebView = MockWebView(); + final MockWebSettings mockWebSettings = MockWebSettings(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + mockSettings: mockWebSettings, + ); + + await controller.loadFile('/path/to/file.html'); + + verify(mockWebSettings.setAllowFileAccess(true)).called(1); + verify(mockWebView.loadUrl( + 'file:///path/to/file.html', + {}, + )).called(1); + }); + + test('loadFile without file prefix and characters to be escaped', () async { + final MockWebView mockWebView = MockWebView(); + final MockWebSettings mockWebSettings = MockWebSettings(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + mockSettings: mockWebSettings, + ); + + await controller.loadFile('/path/to/?_<_>_.html'); + + verify(mockWebSettings.setAllowFileAccess(true)).called(1); + verify(mockWebView.loadUrl( + 'file:///path/to/%3F_%3C_%3E_.html', + {}, + )).called(1); + }); + + test('loadFile with file prefix', () async { + final MockWebView mockWebView = MockWebView(); + final MockWebSettings mockWebSettings = MockWebSettings(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + when(mockWebView.settings).thenReturn(mockWebSettings); + + await controller.loadFile('file:///path/to/file.html'); + + verify(mockWebSettings.setAllowFileAccess(true)).called(1); + verify(mockWebView.loadUrl( + 'file:///path/to/file.html', + {}, + )).called(1); + }); + + test('loadFlutterAsset when asset does not exist', () async { + final MockWebView mockWebView = MockWebView(); + final MockFlutterAssetManager mockAssetManager = + MockFlutterAssetManager(); + final AndroidWebViewController controller = createControllerWithMocks( + mockFlutterAssetManager: mockAssetManager, + mockWebView: mockWebView, + ); + + when(mockAssetManager.getAssetFilePathByName('mock_key')) + .thenAnswer((_) => Future.value('')); + when(mockAssetManager.list('')) + .thenAnswer((_) => Future>.value([])); + + try { + await controller.loadFlutterAsset('mock_key'); + fail('Expected an `ArgumentError`.'); + } on ArgumentError catch (e) { + expect(e.message, 'Asset for key "mock_key" not found.'); + expect(e.name, 'key'); + } on Error { + fail('Expect an `ArgumentError`.'); + } + + verify(mockAssetManager.getAssetFilePathByName('mock_key')).called(1); + verify(mockAssetManager.list('')).called(1); + verifyNever(mockWebView.loadUrl(any, any)); + }); + + test('loadFlutterAsset when asset does exists', () async { + final MockWebView mockWebView = MockWebView(); + final MockFlutterAssetManager mockAssetManager = + MockFlutterAssetManager(); + final AndroidWebViewController controller = createControllerWithMocks( + mockFlutterAssetManager: mockAssetManager, + mockWebView: mockWebView, + ); + + when(mockAssetManager.getAssetFilePathByName('mock_key')) + .thenAnswer((_) => Future.value('www/mock_file.html')); + when(mockAssetManager.list('www')).thenAnswer( + (_) => Future>.value(['mock_file.html'])); + + await controller.loadFlutterAsset('mock_key'); + + verify(mockAssetManager.getAssetFilePathByName('mock_key')).called(1); + verify(mockAssetManager.list('www')).called(1); + verify(mockWebView.loadUrl( + 'file:///android_asset/www/mock_file.html', {})); + }); + + test( + 'loadFlutterAsset when asset name contains characters that should be escaped', + () async { + final MockWebView mockWebView = MockWebView(); + final MockFlutterAssetManager mockAssetManager = + MockFlutterAssetManager(); + final AndroidWebViewController controller = createControllerWithMocks( + mockFlutterAssetManager: mockAssetManager, + mockWebView: mockWebView, + ); + + when(mockAssetManager.getAssetFilePathByName('mock_key')) + .thenAnswer((_) => Future.value('www/?_<_>_.html')); + when(mockAssetManager.list('www')).thenAnswer( + (_) => Future>.value(['?_<_>_.html'])); + + await controller.loadFlutterAsset('mock_key'); + + verify(mockAssetManager.getAssetFilePathByName('mock_key')).called(1); + verify(mockAssetManager.list('www')).called(1); + verify(mockWebView.loadUrl( + 'file:///android_asset/www/%3F_%3C_%3E_.html', {})); + }); + + test('loadHtmlString without baseUrl', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + await controller.loadHtmlString('

Hello Test!

'); + + verify(mockWebView.loadDataWithBaseUrl( + data: '

Hello Test!

', + mimeType: 'text/html', + )).called(1); + }); + + test('loadHtmlString with baseUrl', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + await controller.loadHtmlString('

Hello Test!

', + baseUrl: 'https://flutter.dev'); + + verify(mockWebView.loadDataWithBaseUrl( + data: '

Hello Test!

', + baseUrl: 'https://flutter.dev', + mimeType: 'text/html', + )).called(1); + }); + + test('loadRequest without URI scheme', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + final LoadRequestParams requestParams = LoadRequestParams( + uri: Uri.parse('flutter.dev'), + ); + + try { + await controller.loadRequest(requestParams); + fail('Expect an `ArgumentError`.'); + } on ArgumentError catch (e) { + expect(e.message, 'WebViewRequest#uri is required to have a scheme.'); + } on Error { + fail('Expect a `ArgumentError`.'); + } + + verifyNever(mockWebView.loadUrl(any, any)); + verifyNever(mockWebView.postUrl(any, any)); + }); + + test('loadRequest using the GET method', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + final LoadRequestParams requestParams = LoadRequestParams( + uri: Uri.parse('https://flutter.dev'), + headers: const {'X-Test': 'Testing'}, + ); + + await controller.loadRequest(requestParams); + + verify(mockWebView.loadUrl( + 'https://flutter.dev', + {'X-Test': 'Testing'}, + )); + verifyNever(mockWebView.postUrl(any, any)); + }); + + test('loadRequest using the POST method without body', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + final LoadRequestParams requestParams = LoadRequestParams( + uri: Uri.parse('https://flutter.dev'), + method: LoadRequestMethod.post, + headers: const {'X-Test': 'Testing'}, + ); + + await controller.loadRequest(requestParams); + + verify(mockWebView.postUrl( + 'https://flutter.dev', + Uint8List(0), + )); + verifyNever(mockWebView.loadUrl(any, any)); + }); + + test('loadRequest using the POST method with body', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + final LoadRequestParams requestParams = LoadRequestParams( + uri: Uri.parse('https://flutter.dev'), + method: LoadRequestMethod.post, + headers: const {'X-Test': 'Testing'}, + body: Uint8List.fromList('{"message": "Hello World!"}'.codeUnits), + ); + + await controller.loadRequest(requestParams); + + verify(mockWebView.postUrl( + 'https://flutter.dev', + Uint8List.fromList('{"message": "Hello World!"}'.codeUnits), + )); + verifyNever(mockWebView.loadUrl(any, any)); + }); + + test('currentUrl', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + await controller.currentUrl(); + + verify(mockWebView.getUrl()).called(1); + }); + + test('canGoBack', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + await controller.canGoBack(); + + verify(mockWebView.canGoBack()).called(1); + }); + + test('canGoForward', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + await controller.canGoForward(); + + verify(mockWebView.canGoForward()).called(1); + }); + + test('goBack', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + await controller.goBack(); + + verify(mockWebView.goBack()).called(1); + }); + + test('goForward', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + await controller.goForward(); + + verify(mockWebView.goForward()).called(1); + }); + + test('reload', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + await controller.reload(); + + verify(mockWebView.reload()).called(1); + }); + + test('clearCache', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + await controller.clearCache(); + + verify(mockWebView.clearCache(true)).called(1); + }); + + test('clearLocalStorage', () async { + final MockWebStorage mockWebStorage = MockWebStorage(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebStorage: mockWebStorage, + ); + + await controller.clearLocalStorage(); + + verify(mockWebStorage.deleteAllData()).called(1); + }); + + test('setPlatformNavigationDelegate', () async { + final MockAndroidNavigationDelegate mockNavigationDelegate = + MockAndroidNavigationDelegate(); + final MockWebView mockWebView = MockWebView(); + final MockWebChromeClient mockWebChromeClient = MockWebChromeClient(); + final MockWebViewClient mockWebViewClient = MockWebViewClient(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + when(mockNavigationDelegate.androidWebChromeClient) + .thenReturn(mockWebChromeClient); + when(mockNavigationDelegate.androidWebViewClient) + .thenReturn(mockWebViewClient); + + await controller.setPlatformNavigationDelegate(mockNavigationDelegate); + + verify(mockWebView.setWebViewClient(mockWebViewClient)); + verifyNever(mockWebView.setWebChromeClient(mockWebChromeClient)); + }); + + test('onProgress', () { + final AndroidNavigationDelegate androidNavigationDelegate = + AndroidNavigationDelegate( + AndroidNavigationDelegateCreationParams + .fromPlatformNavigationDelegateCreationParams( + const PlatformNavigationDelegateCreationParams(), + androidWebViewProxy: const AndroidWebViewProxy( + createAndroidWebViewClient: android_webview.WebViewClient.detached, + createAndroidWebChromeClient: + android_webview.WebChromeClient.detached, + createDownloadListener: android_webview.DownloadListener.detached, + ), + ), + ); + + late final int callbackProgress; + androidNavigationDelegate + .setOnProgress((int progress) => callbackProgress = progress); + + final AndroidWebViewController controller = createControllerWithMocks( + createWebChromeClient: CapturingWebChromeClient.new, + ); + controller.setPlatformNavigationDelegate(androidNavigationDelegate); + + CapturingWebChromeClient.lastCreatedDelegate.onProgressChanged!( + android_webview.WebView.detached(), + 42, + ); + + expect(callbackProgress, 42); + }); + + test('onProgress does not cause LateInitializationError', () { + // ignore: unused_local_variable + final AndroidWebViewController controller = createControllerWithMocks( + createWebChromeClient: CapturingWebChromeClient.new, + ); + + // Should not cause LateInitializationError + CapturingWebChromeClient.lastCreatedDelegate.onProgressChanged!( + android_webview.WebView.detached(), + 42, + ); + }); + + test('setOnShowFileSelector', () async { + late final Future> Function( + android_webview.WebView webView, + android_webview.FileChooserParams params, + ) onShowFileChooserCallback; + final MockWebChromeClient mockWebChromeClient = MockWebChromeClient(); + final AndroidWebViewController controller = createControllerWithMocks( + createWebChromeClient: ({ + dynamic onProgressChanged, + Future> Function( + android_webview.WebView webView, + android_webview.FileChooserParams params, + )? onShowFileChooser, + dynamic onGeolocationPermissionsShowPrompt, + dynamic onGeolocationPermissionsHidePrompt, + dynamic onPermissionRequest, + dynamic onShowCustomView, + dynamic onHideCustomView, + }) { + onShowFileChooserCallback = onShowFileChooser!; + return mockWebChromeClient; + }, + ); + + late final FileSelectorParams fileSelectorParams; + await controller.setOnShowFileSelector( + (FileSelectorParams params) async { + fileSelectorParams = params; + return []; + }, + ); + + verify( + mockWebChromeClient.setSynchronousReturnValueForOnShowFileChooser(true), + ); + + onShowFileChooserCallback( + android_webview.WebView.detached(), + android_webview.FileChooserParams.detached( + isCaptureEnabled: false, + acceptTypes: const ['png'], + filenameHint: 'filenameHint', + mode: android_webview.FileChooserMode.open, + ), + ); + + expect(fileSelectorParams.isCaptureEnabled, isFalse); + expect(fileSelectorParams.acceptTypes, ['png']); + expect(fileSelectorParams.filenameHint, 'filenameHint'); + expect(fileSelectorParams.mode, FileSelectorMode.open); + }); + + test('setGeolocationPermissionsPromptCallbacks', () async { + final MockTestGeolocationPermissionsCallbackHostApi mockApi = + MockTestGeolocationPermissionsCallbackHostApi(); + TestGeolocationPermissionsCallbackHostApi.setup(mockApi); + + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + + final android_webview.GeolocationPermissionsCallback testCallback = + android_webview.GeolocationPermissionsCallback.detached( + instanceManager: instanceManager, + ); + + const int instanceIdentifier = 0; + instanceManager.addHostCreatedInstance(testCallback, instanceIdentifier); + + late final Future Function(String origin, + android_webview.GeolocationPermissionsCallback callback) + onGeoPermissionHandle; + late final void Function(android_webview.WebChromeClient instance) + onGeoPermissionHidePromptHandle; + + final MockWebChromeClient mockWebChromeClient = MockWebChromeClient(); + final AndroidWebViewController controller = createControllerWithMocks( + createWebChromeClient: ({ + dynamic onProgressChanged, + dynamic onShowFileChooser, + Future Function(String origin, + android_webview.GeolocationPermissionsCallback callback)? + onGeolocationPermissionsShowPrompt, + void Function(android_webview.WebChromeClient instance)? + onGeolocationPermissionsHidePrompt, + dynamic onPermissionRequest, + dynamic onShowCustomView, + dynamic onHideCustomView, + }) { + onGeoPermissionHandle = onGeolocationPermissionsShowPrompt!; + onGeoPermissionHidePromptHandle = onGeolocationPermissionsHidePrompt!; + return mockWebChromeClient; + }, + ); + + String testValue = 'origin'; + const String allowOrigin = 'https://www.allow.com'; + bool isAllow = false; + + late final GeolocationPermissionsResponse response; + controller.setGeolocationPermissionsPromptCallbacks( + onShowPrompt: (GeolocationPermissionsRequestParams request) async { + isAllow = request.origin == allowOrigin; + response = + GeolocationPermissionsResponse(allow: isAllow, retain: isAllow); + return response; + }, + onHidePrompt: () { + testValue = 'changed'; + }, + ); + + await onGeoPermissionHandle( + allowOrigin, + testCallback, + ); + + expect(isAllow, true); + + onGeoPermissionHidePromptHandle(mockWebChromeClient); + expect(testValue, 'changed'); + }); + + test('setCustomViewCallbacks', () async { + final MockTestCustomViewCallbackHostApi mockApi = + MockTestCustomViewCallbackHostApi(); + TestCustomViewCallbackHostApi.setup(mockApi); + + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + + final android_webview.CustomViewCallback testCallback = + android_webview.CustomViewCallback.detached( + instanceManager: instanceManager, + ); + + const int instanceIdentifier = 0; + instanceManager.addHostCreatedInstance(testCallback, instanceIdentifier); + + late final void Function( + android_webview.WebChromeClient instance, + android_webview.View view, + android_webview.CustomViewCallback callback) onShowCustomViewHandle; + late final void Function(android_webview.WebChromeClient instance) + onHideCustomViewHandle; + + final MockWebChromeClient mockWebChromeClient = MockWebChromeClient(); + final AndroidWebViewController controller = createControllerWithMocks( + createWebChromeClient: ({ + dynamic onProgressChanged, + dynamic onShowFileChooser, + dynamic onGeolocationPermissionsShowPrompt, + dynamic onGeolocationPermissionsHidePrompt, + dynamic onPermissionRequest, + void Function( + android_webview.WebChromeClient instance, + android_webview.View view, + android_webview.CustomViewCallback callback)? + onShowCustomView, + void Function(android_webview.WebChromeClient instance)? + onHideCustomView, + }) { + onShowCustomViewHandle = onShowCustomView!; + onHideCustomViewHandle = onHideCustomView!; + return mockWebChromeClient; + }, + ); + + final android_webview.View testView = android_webview.View.detached(); + bool showCustomViewCalled = false; + bool hideCustomViewCalled = false; + + controller.setCustomViewCallbacks( + onShowCustomView: (AndroidCustomViewWidget widget, + OnHideCustomViewCallback callback) async { + showCustomViewCalled = true; + }, + onHideCustomView: () { + hideCustomViewCalled = true; + }, + ); + + onShowCustomViewHandle( + mockWebChromeClient, + testView, + android_webview.CustomViewCallback.detached(), + ); + + expect(showCustomViewCalled, true); + + onHideCustomViewHandle(mockWebChromeClient); + expect(hideCustomViewCalled, true); + }); + + test('setOnPlatformPermissionRequest', () async { + late final void Function( + android_webview.WebChromeClient instance, + android_webview.PermissionRequest request, + ) onPermissionRequestCallback; + + final MockWebChromeClient mockWebChromeClient = MockWebChromeClient(); + final AndroidWebViewController controller = createControllerWithMocks( + createWebChromeClient: ({ + dynamic onProgressChanged, + dynamic onShowFileChooser, + dynamic onGeolocationPermissionsShowPrompt, + dynamic onGeolocationPermissionsHidePrompt, + void Function( + android_webview.WebChromeClient instance, + android_webview.PermissionRequest request, + )? onPermissionRequest, + dynamic onShowCustomView, + dynamic onHideCustomView, + }) { + onPermissionRequestCallback = onPermissionRequest!; + return mockWebChromeClient; + }, + ); + + late final PlatformWebViewPermissionRequest permissionRequest; + await controller.setOnPlatformPermissionRequest( + (PlatformWebViewPermissionRequest request) async { + permissionRequest = request; + request.grant(); + }, + ); + + final List permissionTypes = [ + android_webview.PermissionRequest.audioCapture, + ]; + + final MockPermissionRequest mockPermissionRequest = + MockPermissionRequest(); + when(mockPermissionRequest.resources).thenReturn(permissionTypes); + + onPermissionRequestCallback( + android_webview.WebChromeClient.detached(), + mockPermissionRequest, + ); + + expect(permissionRequest.types, [ + WebViewPermissionResourceType.microphone, + ]); + verify(mockPermissionRequest.grant(permissionTypes)); + }); + + test( + 'setOnPlatformPermissionRequest callback not invoked when type is not recognized', + () async { + late final void Function( + android_webview.WebChromeClient instance, + android_webview.PermissionRequest request, + ) onPermissionRequestCallback; + + final MockWebChromeClient mockWebChromeClient = MockWebChromeClient(); + final AndroidWebViewController controller = createControllerWithMocks( + createWebChromeClient: ({ + dynamic onProgressChanged, + dynamic onShowFileChooser, + dynamic onGeolocationPermissionsShowPrompt, + dynamic onGeolocationPermissionsHidePrompt, + void Function( + android_webview.WebChromeClient instance, + android_webview.PermissionRequest request, + )? onPermissionRequest, + dynamic onShowCustomView, + dynamic onHideCustomView, + }) { + onPermissionRequestCallback = onPermissionRequest!; + return mockWebChromeClient; + }, + ); + + bool callbackCalled = false; + await controller.setOnPlatformPermissionRequest( + (PlatformWebViewPermissionRequest request) async { + callbackCalled = true; + }, + ); + + final MockPermissionRequest mockPermissionRequest = + MockPermissionRequest(); + when(mockPermissionRequest.resources).thenReturn(['unknownType']); + + onPermissionRequestCallback( + android_webview.WebChromeClient.detached(), + mockPermissionRequest, + ); + + expect(callbackCalled, isFalse); + }); + + test('runJavaScript', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + await controller.runJavaScript('alert("This is a test.");'); + + verify(mockWebView.evaluateJavascript('alert("This is a test.");')) + .called(1); + }); + + test('runJavaScriptReturningResult with return value', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + when(mockWebView.evaluateJavascript('return "Hello" + " World!";')) + .thenAnswer((_) => Future.value('Hello World!')); + + final String message = await controller.runJavaScriptReturningResult( + 'return "Hello" + " World!";') as String; + + expect(message, 'Hello World!'); + }); + + test('runJavaScriptReturningResult returning null', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + when(mockWebView.evaluateJavascript('alert("This is a test.");')) + .thenAnswer((_) => Future.value()); + + final String message = await controller + .runJavaScriptReturningResult('alert("This is a test.");') as String; + + expect(message, ''); + }); + + test('runJavaScriptReturningResult parses num', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + when(mockWebView.evaluateJavascript('alert("This is a test.");')) + .thenAnswer((_) => Future.value('3.14')); + + final num message = await controller + .runJavaScriptReturningResult('alert("This is a test.");') as num; + + expect(message, 3.14); + }); + + test('runJavaScriptReturningResult parses true', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + when(mockWebView.evaluateJavascript('alert("This is a test.");')) + .thenAnswer((_) => Future.value('true')); + + final bool message = await controller + .runJavaScriptReturningResult('alert("This is a test.");') as bool; + + expect(message, true); + }); + + test('runJavaScriptReturningResult parses false', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + when(mockWebView.evaluateJavascript('alert("This is a test.");')) + .thenAnswer((_) => Future.value('false')); + + final bool message = await controller + .runJavaScriptReturningResult('alert("This is a test.");') as bool; + + expect(message, false); + }); + + test('addJavaScriptChannel', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + final AndroidJavaScriptChannelParams paramsWithMock = + createAndroidJavaScriptChannelParamsWithMocks(name: 'test'); + await controller.addJavaScriptChannel(paramsWithMock); + verify(mockWebView.addJavaScriptChannel( + argThat(isA()))) + .called(1); + }); + + test( + 'addJavaScriptChannel add channel with same name should remove existing channel', + () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + final AndroidJavaScriptChannelParams paramsWithMock = + createAndroidJavaScriptChannelParamsWithMocks(name: 'test'); + await controller.addJavaScriptChannel(paramsWithMock); + verify(mockWebView.addJavaScriptChannel( + argThat(isA()))) + .called(1); + + await controller.addJavaScriptChannel(paramsWithMock); + verifyInOrder([ + mockWebView.removeJavaScriptChannel( + argThat(isA())), + mockWebView.addJavaScriptChannel( + argThat(isA())), + ]); + }); + + test('removeJavaScriptChannel when channel is not registered', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + await controller.removeJavaScriptChannel('test'); + verifyNever(mockWebView.removeJavaScriptChannel(any)); + }); + + test('removeJavaScriptChannel when channel exists', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + final AndroidJavaScriptChannelParams paramsWithMock = + createAndroidJavaScriptChannelParamsWithMocks(name: 'test'); + + // Make sure channel exists before removing it. + await controller.addJavaScriptChannel(paramsWithMock); + verify(mockWebView.addJavaScriptChannel( + argThat(isA()))) + .called(1); + + await controller.removeJavaScriptChannel('test'); + verify(mockWebView.removeJavaScriptChannel( + argThat(isA()))) + .called(1); + }); + + test('getTitle', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + await controller.getTitle(); + + verify(mockWebView.getTitle()).called(1); + }); + + test('scrollTo', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + await controller.scrollTo(4, 2); + + verify(mockWebView.scrollTo(4, 2)).called(1); + }); + + test('scrollBy', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + await controller.scrollBy(4, 2); + + verify(mockWebView.scrollBy(4, 2)).called(1); + }); + + test('getScrollPosition', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + when(mockWebView.getScrollPosition()) + .thenAnswer((_) => Future.value(const Offset(4, 2))); + + final Offset position = await controller.getScrollPosition(); + + verify(mockWebView.getScrollPosition()).called(1); + expect(position.dx, 4); + expect(position.dy, 2); + }); + + test('enableDebugging', () async { + final MockAndroidWebViewProxy mockProxy = MockAndroidWebViewProxy(); + + await AndroidWebViewController.enableDebugging( + true, + webViewProxy: mockProxy, + ); + verify(mockProxy.setWebContentsDebuggingEnabled(true)).called(1); + }); + + test('enableZoom', () async { + final MockWebView mockWebView = MockWebView(); + final MockWebSettings mockSettings = MockWebSettings(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + mockSettings: mockSettings, + ); + + clearInteractions(mockWebView); + + await controller.enableZoom(true); + + verify(mockWebView.settings).called(1); + verify(mockSettings.setSupportZoom(true)).called(1); + }); + + test('setBackgroundColor', () async { + final MockWebView mockWebView = MockWebView(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + await controller.setBackgroundColor(Colors.blue); + + verify(mockWebView.setBackgroundColor(Colors.blue)).called(1); + }); + + test('setJavaScriptMode', () async { + final MockWebView mockWebView = MockWebView(); + final MockWebSettings mockSettings = MockWebSettings(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + mockSettings: mockSettings, + ); + + clearInteractions(mockWebView); + + await controller.setJavaScriptMode(JavaScriptMode.disabled); + + verify(mockWebView.settings).called(1); + verify(mockSettings.setJavaScriptEnabled(false)).called(1); + }); + + test('setUserAgent', () async { + final MockWebView mockWebView = MockWebView(); + final MockWebSettings mockSettings = MockWebSettings(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + mockSettings: mockSettings, + ); + + clearInteractions(mockWebView); + + await controller.setUserAgent('Test Framework'); + + verify(mockWebView.settings).called(1); + verify(mockSettings.setUserAgentString('Test Framework')).called(1); + }); + }); + + test('setMediaPlaybackRequiresUserGesture', () async { + final MockWebView mockWebView = MockWebView(); + final MockWebSettings mockSettings = MockWebSettings(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + mockSettings: mockSettings, + ); + + await controller.setMediaPlaybackRequiresUserGesture(true); + + verify(mockSettings.setMediaPlaybackRequiresUserGesture(true)).called(1); + }); + + test('setTextZoom', () async { + final MockWebView mockWebView = MockWebView(); + final MockWebSettings mockSettings = MockWebSettings(); + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + mockSettings: mockSettings, + ); + + clearInteractions(mockWebView); + + await controller.setTextZoom(100); + + verify(mockWebView.settings).called(1); + verify(mockSettings.setTextZoom(100)).called(1); + }); + + test('webViewIdentifier', () { + final MockWebView mockWebView = MockWebView(); + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + instanceManager.addHostCreatedInstance(mockWebView, 0); + + android_webview.WebView.api = WebViewHostApiImpl( + instanceManager: instanceManager, + ); + + final AndroidWebViewController controller = createControllerWithMocks( + mockWebView: mockWebView, + ); + + expect( + controller.webViewIdentifier, + 0, + ); + + android_webview.WebView.api = WebViewHostApiImpl(); + }); + + group('AndroidWebViewWidget', () { + testWidgets('Builds Android view using supplied parameters', + (WidgetTester tester) async { + final AndroidWebViewController controller = createControllerWithMocks(); + + final AndroidWebViewWidget webViewWidget = AndroidWebViewWidget( + AndroidWebViewWidgetCreationParams( + key: const Key('test_web_view'), + controller: controller, + ), + ); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) => webViewWidget.build(context), + )); + + expect(find.byType(PlatformViewLink), findsOneWidget); + expect(find.byKey(const Key('test_web_view')), findsOneWidget); + }); + + testWidgets('displayWithHybridComposition is false', + (WidgetTester tester) async { + final AndroidWebViewController controller = createControllerWithMocks(); + + final MockPlatformViewsServiceProxy mockPlatformViewsService = + MockPlatformViewsServiceProxy(); + + when( + mockPlatformViewsService.initSurfaceAndroidView( + id: anyNamed('id'), + viewType: anyNamed('viewType'), + layoutDirection: anyNamed('layoutDirection'), + creationParams: anyNamed('creationParams'), + creationParamsCodec: anyNamed('creationParamsCodec'), + onFocus: anyNamed('onFocus'), + ), + ).thenReturn(MockSurfaceAndroidViewController()); + + final AndroidWebViewWidget webViewWidget = AndroidWebViewWidget( + AndroidWebViewWidgetCreationParams( + key: const Key('test_web_view'), + controller: controller, + platformViewsServiceProxy: mockPlatformViewsService, + ), + ); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) => webViewWidget.build(context), + )); + await tester.pumpAndSettle(); + + verify( + mockPlatformViewsService.initSurfaceAndroidView( + id: anyNamed('id'), + viewType: anyNamed('viewType'), + layoutDirection: anyNamed('layoutDirection'), + creationParams: anyNamed('creationParams'), + creationParamsCodec: anyNamed('creationParamsCodec'), + onFocus: anyNamed('onFocus'), + ), + ); + }); + + testWidgets('displayWithHybridComposition is true', + (WidgetTester tester) async { + final AndroidWebViewController controller = createControllerWithMocks(); + + final MockPlatformViewsServiceProxy mockPlatformViewsService = + MockPlatformViewsServiceProxy(); + + when( + mockPlatformViewsService.initExpensiveAndroidView( + id: anyNamed('id'), + viewType: anyNamed('viewType'), + layoutDirection: anyNamed('layoutDirection'), + creationParams: anyNamed('creationParams'), + creationParamsCodec: anyNamed('creationParamsCodec'), + onFocus: anyNamed('onFocus'), + ), + ).thenReturn(MockExpensiveAndroidViewController()); + + final AndroidWebViewWidget webViewWidget = AndroidWebViewWidget( + AndroidWebViewWidgetCreationParams( + key: const Key('test_web_view'), + controller: controller, + platformViewsServiceProxy: mockPlatformViewsService, + displayWithHybridComposition: true, + ), + ); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) => webViewWidget.build(context), + )); + await tester.pumpAndSettle(); + + verify( + mockPlatformViewsService.initExpensiveAndroidView( + id: anyNamed('id'), + viewType: anyNamed('viewType'), + layoutDirection: anyNamed('layoutDirection'), + creationParams: anyNamed('creationParams'), + creationParamsCodec: anyNamed('creationParamsCodec'), + onFocus: anyNamed('onFocus'), + ), + ); + }); + }); + + group('AndroidCustomViewWidget', () { + testWidgets('Builds Android custom view using supplied parameters', + (WidgetTester tester) async { + final AndroidWebViewController controller = createControllerWithMocks(); + + final AndroidCustomViewWidget customViewWidget = + AndroidCustomViewWidget.private( + key: const Key('test_custom_view'), + creationParams: AndroidCustomViewWidgetCreationParams( + customView: android_webview.View.detached(), + controller: controller, + ), + ); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) => customViewWidget.build(context), + )); + + expect(find.byType(PlatformViewLink), findsOneWidget); + expect(find.byKey(const Key('test_custom_view')), findsOneWidget); + }); + + testWidgets('displayWithHybridComposition is false', + (WidgetTester tester) async { + final AndroidWebViewController controller = createControllerWithMocks(); + + final MockPlatformViewsServiceProxy mockPlatformViewsService = + MockPlatformViewsServiceProxy(); + + when( + mockPlatformViewsService.initSurfaceAndroidView( + id: anyNamed('id'), + viewType: anyNamed('viewType'), + layoutDirection: anyNamed('layoutDirection'), + creationParams: anyNamed('creationParams'), + creationParamsCodec: anyNamed('creationParamsCodec'), + onFocus: anyNamed('onFocus'), + ), + ).thenReturn(MockSurfaceAndroidViewController()); + + final AndroidCustomViewWidget customViewWidget = + AndroidCustomViewWidget.private( + creationParams: AndroidCustomViewWidgetCreationParams( + controller: controller, + customView: android_webview.View.detached(), + platformViewsServiceProxy: mockPlatformViewsService, + ), + ); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) => customViewWidget.build(context), + )); + await tester.pumpAndSettle(); + + verify( + mockPlatformViewsService.initSurfaceAndroidView( + id: anyNamed('id'), + viewType: anyNamed('viewType'), + layoutDirection: anyNamed('layoutDirection'), + creationParams: anyNamed('creationParams'), + creationParamsCodec: anyNamed('creationParamsCodec'), + onFocus: anyNamed('onFocus'), + ), + ); + }); + + testWidgets('displayWithHybridComposition is true', + (WidgetTester tester) async { + final AndroidWebViewController controller = createControllerWithMocks(); + + final MockPlatformViewsServiceProxy mockPlatformViewsService = + MockPlatformViewsServiceProxy(); + + when( + mockPlatformViewsService.initExpensiveAndroidView( + id: anyNamed('id'), + viewType: anyNamed('viewType'), + layoutDirection: anyNamed('layoutDirection'), + creationParams: anyNamed('creationParams'), + creationParamsCodec: anyNamed('creationParamsCodec'), + onFocus: anyNamed('onFocus'), + ), + ).thenReturn(MockExpensiveAndroidViewController()); + + final AndroidCustomViewWidget webViewWidget = + AndroidCustomViewWidget.private( + creationParams: AndroidCustomViewWidgetCreationParams( + controller: controller, + customView: android_webview.View.detached(), + platformViewsServiceProxy: mockPlatformViewsService, + displayWithHybridComposition: true, + ), + ); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) => webViewWidget.build(context), + )); + await tester.pumpAndSettle(); + + verify( + mockPlatformViewsService.initExpensiveAndroidView( + id: anyNamed('id'), + viewType: anyNamed('viewType'), + layoutDirection: anyNamed('layoutDirection'), + creationParams: anyNamed('creationParams'), + creationParamsCodec: anyNamed('creationParamsCodec'), + onFocus: anyNamed('onFocus'), + ), + ); + }); + }); +} diff --git a/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.dart b/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.dart index 3f93d46b7705..0693ef5d4ce9 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.dart @@ -517,6 +517,8 @@ class CapturingWebChromeClient extends android_webview.WebChromeClient { super.onShowFileChooser, super.onGeolocationPermissionsShowPrompt, super.onGeolocationPermissionsHidePrompt, + super.onShowCustomView, + super.onHideCustomView, super.onPermissionRequest, super.binaryMessenger, super.instanceManager, diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart index d8527ca9e0eb..5bc73c997256 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart @@ -19,7 +19,9 @@ import 'package:webview_flutter_platform_interface/webview_flutter_platform_inte import 'android_navigation_delegate_test.dart'; import 'android_webview_controller_test.mocks.dart'; import 'android_webview_test.mocks.dart' - show MockTestGeolocationPermissionsCallbackHostApi; + show + MockTestGeolocationPermissionsCallbackHostApi, + MockTestCustomViewCallbackHostApi; import 'test_android_webview.g.dart'; @GenerateNiceMocks(>[ @@ -65,6 +67,12 @@ void main() { android_webview.WebChromeClient instance, android_webview.PermissionRequest request, )? onPermissionRequest, + void Function( + android_webview.WebChromeClient instance, + android_webview.View view, + android_webview.CustomViewCallback callback)? + onShowCustomView, + void Function(android_webview.WebChromeClient instance)? onHideCustomView, })? createWebChromeClient, android_webview.WebView? mockWebView, android_webview.WebViewClient? mockWebViewClient, @@ -79,25 +87,31 @@ void main() { androidWebStorage: mockWebStorage ?? MockWebStorage(), androidWebViewProxy: AndroidWebViewProxy( createAndroidWebChromeClient: createWebChromeClient ?? - ( - {void Function(android_webview.WebView, int)? - onProgressChanged, - Future> Function( - android_webview.WebView webView, - android_webview.FileChooserParams params, - )? onShowFileChooser, - void Function( + ({ + void Function(android_webview.WebView, int)? + onProgressChanged, + Future> Function( + android_webview.WebView webView, + android_webview.FileChooserParams params, + )? onShowFileChooser, + void Function( + android_webview.WebChromeClient instance, + android_webview.PermissionRequest request, + )? onPermissionRequest, + Future Function( + String origin, + android_webview.GeolocationPermissionsCallback callback, + )? onGeolocationPermissionsShowPrompt, + void Function(android_webview.WebChromeClient instance)? + onGeolocationPermissionsHidePrompt, + void Function( android_webview.WebChromeClient instance, - android_webview.PermissionRequest request, - )? onPermissionRequest, - Future Function( - String origin, - android_webview.GeolocationPermissionsCallback - callback, - )? onGeolocationPermissionsShowPrompt, - void Function( - android_webview.WebChromeClient instance)? - onGeolocationPermissionsHidePrompt}) => + android_webview.View view, + android_webview.CustomViewCallback callback)? + onShowCustomView, + void Function(android_webview.WebChromeClient instance)? + onHideCustomView, + }) => MockWebChromeClient(), createAndroidWebView: () => nonNullMockWebView, createAndroidWebViewClient: ({ @@ -590,6 +604,8 @@ void main() { dynamic onGeolocationPermissionsShowPrompt, dynamic onGeolocationPermissionsHidePrompt, dynamic onPermissionRequest, + dynamic onShowCustomView, + dynamic onHideCustomView, }) { onShowFileChooserCallback = onShowFileChooser!; return mockWebChromeClient; @@ -658,6 +674,8 @@ void main() { void Function(android_webview.WebChromeClient instance)? onGeolocationPermissionsHidePrompt, dynamic onPermissionRequest, + dynamic onShowCustomView, + dynamic onHideCustomView, }) { onGeoPermissionHandle = onGeolocationPermissionsShowPrompt!; onGeoPermissionHidePromptHandle = onGeolocationPermissionsHidePrompt!; @@ -693,6 +711,78 @@ void main() { expect(testValue, 'changed'); }); + test('setCustomViewCallbacks', () async { + final MockTestCustomViewCallbackHostApi mockApi = + MockTestCustomViewCallbackHostApi(); + TestCustomViewCallbackHostApi.setup(mockApi); + + final InstanceManager instanceManager = InstanceManager( + onWeakReferenceRemoved: (_) {}, + ); + + final android_webview.CustomViewCallback testCallback = + android_webview.CustomViewCallback.detached( + instanceManager: instanceManager, + ); + + const int instanceIdentifier = 0; + instanceManager.addHostCreatedInstance(testCallback, instanceIdentifier); + + late final void Function( + android_webview.WebChromeClient instance, + android_webview.View view, + android_webview.CustomViewCallback callback) onShowCustomViewHandle; + late final void Function(android_webview.WebChromeClient instance) + onHideCustomViewHandle; + + final MockWebChromeClient mockWebChromeClient = MockWebChromeClient(); + final AndroidWebViewController controller = createControllerWithMocks( + createWebChromeClient: ({ + dynamic onProgressChanged, + dynamic onShowFileChooser, + dynamic onGeolocationPermissionsShowPrompt, + dynamic onGeolocationPermissionsHidePrompt, + dynamic onPermissionRequest, + void Function( + android_webview.WebChromeClient instance, + android_webview.View view, + android_webview.CustomViewCallback callback)? + onShowCustomView, + void Function(android_webview.WebChromeClient instance)? + onHideCustomView, + }) { + onShowCustomViewHandle = onShowCustomView!; + onHideCustomViewHandle = onHideCustomView!; + return mockWebChromeClient; + }, + ); + + final android_webview.View testView = android_webview.View.detached(); + bool showCustomViewCalled = false; + bool hideCustomViewCalled = false; + + controller.setCustomViewCallbacks( + onShowCustomView: (AndroidCustomViewWidget widget, + OnHideCustomViewCallback callback) async { + showCustomViewCalled = true; + }, + onHideCustomView: () { + hideCustomViewCalled = true; + }, + ); + + onShowCustomViewHandle( + mockWebChromeClient, + testView, + android_webview.CustomViewCallback.detached(), + ); + + expect(showCustomViewCalled, true); + + onHideCustomViewHandle(mockWebChromeClient); + expect(hideCustomViewCalled, true); + }); + test('setOnPlatformPermissionRequest', () async { late final void Function( android_webview.WebChromeClient instance, @@ -710,6 +800,8 @@ void main() { android_webview.WebChromeClient instance, android_webview.PermissionRequest request, )? onPermissionRequest, + dynamic onShowCustomView, + dynamic onHideCustomView, }) { onPermissionRequestCallback = onPermissionRequest!; return mockWebChromeClient; @@ -762,6 +854,8 @@ void main() { android_webview.WebChromeClient instance, android_webview.PermissionRequest request, )? onPermissionRequest, + dynamic onShowCustomView, + dynamic onHideCustomView, }) { onPermissionRequestCallback = onPermissionRequest!; return mockWebChromeClient; @@ -1217,4 +1311,116 @@ void main() { ); }); }); + + group('AndroidCustomViewWidget', () { + testWidgets('Builds Android custom view using supplied parameters', + (WidgetTester tester) async { + final AndroidWebViewController controller = createControllerWithMocks(); + + final AndroidCustomViewWidget customViewWidget = + AndroidCustomViewWidget.private( + key: const Key('test_custom_view'), + creationParams: AndroidCustomViewWidgetCreationParams( + customView: android_webview.View.detached(), + controller: controller, + ), + ); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) => customViewWidget.build(context), + )); + + expect(find.byType(PlatformViewLink), findsOneWidget); + expect(find.byKey(const Key('test_custom_view')), findsOneWidget); + }); + + testWidgets('displayWithHybridComposition is false', + (WidgetTester tester) async { + final AndroidWebViewController controller = createControllerWithMocks(); + + final MockPlatformViewsServiceProxy mockPlatformViewsService = + MockPlatformViewsServiceProxy(); + + when( + mockPlatformViewsService.initSurfaceAndroidView( + id: anyNamed('id'), + viewType: anyNamed('viewType'), + layoutDirection: anyNamed('layoutDirection'), + creationParams: anyNamed('creationParams'), + creationParamsCodec: anyNamed('creationParamsCodec'), + onFocus: anyNamed('onFocus'), + ), + ).thenReturn(MockSurfaceAndroidViewController()); + + final AndroidCustomViewWidget customViewWidget = + AndroidCustomViewWidget.private( + creationParams: AndroidCustomViewWidgetCreationParams( + controller: controller, + customView: android_webview.View.detached(), + platformViewsServiceProxy: mockPlatformViewsService, + ), + ); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) => customViewWidget.build(context), + )); + await tester.pumpAndSettle(); + + verify( + mockPlatformViewsService.initSurfaceAndroidView( + id: anyNamed('id'), + viewType: anyNamed('viewType'), + layoutDirection: anyNamed('layoutDirection'), + creationParams: anyNamed('creationParams'), + creationParamsCodec: anyNamed('creationParamsCodec'), + onFocus: anyNamed('onFocus'), + ), + ); + }); + + testWidgets('displayWithHybridComposition is true', + (WidgetTester tester) async { + final AndroidWebViewController controller = createControllerWithMocks(); + + final MockPlatformViewsServiceProxy mockPlatformViewsService = + MockPlatformViewsServiceProxy(); + + when( + mockPlatformViewsService.initExpensiveAndroidView( + id: anyNamed('id'), + viewType: anyNamed('viewType'), + layoutDirection: anyNamed('layoutDirection'), + creationParams: anyNamed('creationParams'), + creationParamsCodec: anyNamed('creationParamsCodec'), + onFocus: anyNamed('onFocus'), + ), + ).thenReturn(MockExpensiveAndroidViewController()); + + final AndroidCustomViewWidget webViewWidget = + AndroidCustomViewWidget.private( + creationParams: AndroidCustomViewWidgetCreationParams( + controller: controller, + customView: android_webview.View.detached(), + platformViewsServiceProxy: mockPlatformViewsService, + displayWithHybridComposition: true, + ), + ); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) => webViewWidget.build(context), + )); + await tester.pumpAndSettle(); + + verify( + mockPlatformViewsService.initExpensiveAndroidView( + id: anyNamed('id'), + viewType: anyNamed('viewType'), + layoutDirection: anyNamed('layoutDirection'), + creationParams: anyNamed('creationParams'), + creationParamsCodec: anyNamed('creationParamsCodec'), + onFocus: anyNamed('onFocus'), + ), + ); + }); + }); } diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart index 6792c1034561..3037ff10b917 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart @@ -6,12 +6,11 @@ // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i9; -import 'dart:typed_data' as _i14; +import 'dart:typed_data' as _i13; import 'dart:ui' as _i4; import 'package:flutter/foundation.dart' as _i11; import 'package:flutter/gestures.dart' as _i12; -import 'package:flutter/material.dart' as _i13; import 'package:flutter/services.dart' as _i7; import 'package:mockito/mockito.dart' as _i1; import 'package:webview_flutter_android/src/android_proxy.dart' as _i10; @@ -24,7 +23,7 @@ import 'package:webview_flutter_android/src/platform_views_service_proxy.dart' import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart' as _i3; -import 'test_android_webview.g.dart' as _i15; +import 'test_android_webview.g.dart' as _i14; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -738,6 +737,23 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i9.Future.value(), returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); + @override + _i9.Future setCustomViewCallbacks({ + _i8.OnShowCustomViewCallback? onShowCustomView, + _i8.OnHideCustomViewCallback? onHideCustomView, + }) => + (super.noSuchMethod( + Invocation.method( + #setCustomViewCallbacks, + [], + { + #onShowCustomView: onShowCustomView, + #onHideCustomView: onHideCustomView, + }, + ), + returnValue: _i9.Future.value(), + returnValueForMissingStub: _i9.Future.value(), + ) as _i9.Future); } /// A class which mocks [AndroidWebViewProxy]. @@ -764,6 +780,7 @@ class MockAndroidWebViewProxy extends _i1.Mock String, _i2.GeolocationPermissionsCallback, )? onGeolocationPermissionsShowPrompt, + void Function(_i2.WebChromeClient)? onHideCustomView, void Function( _i2.WebChromeClient, _i2.PermissionRequest, @@ -772,6 +789,11 @@ class MockAndroidWebViewProxy extends _i1.Mock _i2.WebView, int, )? onProgressChanged, + void Function( + _i2.WebChromeClient, + _i2.View, + _i2.CustomViewCallback, + )? onShowCustomView, _i9.Future> Function( _i2.WebView, _i2.FileChooserParams, @@ -785,6 +807,7 @@ class MockAndroidWebViewProxy extends _i1.Mock String, _i2.GeolocationPermissionsCallback, )? onGeolocationPermissionsShowPrompt, + void Function(_i2.WebChromeClient)? onHideCustomView, void Function( _i2.WebChromeClient, _i2.PermissionRequest, @@ -793,6 +816,11 @@ class MockAndroidWebViewProxy extends _i1.Mock _i2.WebView, int, )? onProgressChanged, + void Function( + _i2.WebChromeClient, + _i2.View, + _i2.CustomViewCallback, + )? onShowCustomView, _i9.Future> Function( _i2.WebView, _i2.FileChooserParams, @@ -809,6 +837,7 @@ class MockAndroidWebViewProxy extends _i1.Mock String, _i2.GeolocationPermissionsCallback, )? onGeolocationPermissionsShowPrompt, + void Function(_i2.WebChromeClient)? onHideCustomView, void Function( _i2.WebChromeClient, _i2.PermissionRequest, @@ -817,6 +846,11 @@ class MockAndroidWebViewProxy extends _i1.Mock _i2.WebView, int, )? onProgressChanged, + void Function( + _i2.WebChromeClient, + _i2.View, + _i2.CustomViewCallback, + )? onShowCustomView, _i9.Future> Function( _i2.WebView, _i2.FileChooserParams, @@ -832,6 +866,7 @@ class MockAndroidWebViewProxy extends _i1.Mock String, _i2.GeolocationPermissionsCallback, )? onGeolocationPermissionsShowPrompt, + void Function(_i2.WebChromeClient)? onHideCustomView, void Function( _i2.WebChromeClient, _i2.PermissionRequest, @@ -840,6 +875,11 @@ class MockAndroidWebViewProxy extends _i1.Mock _i2.WebView, int, )? onProgressChanged, + void Function( + _i2.WebChromeClient, + _i2.View, + _i2.CustomViewCallback, + )? onShowCustomView, _i9.Future> Function( _i2.WebView, _i2.FileChooserParams, @@ -1293,7 +1333,7 @@ class MockExpensiveAndroidViewController extends _i1.Mock returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - _i9.Future dispatchPointerEvent(_i13.PointerEvent? event) => + _i9.Future dispatchPointerEvent(_i12.PointerEvent? event) => (super.noSuchMethod( Invocation.method( #dispatchPointerEvent, @@ -1696,7 +1736,7 @@ class MockSurfaceAndroidViewController extends _i1.Mock returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - _i9.Future dispatchPointerEvent(_i13.PointerEvent? event) => + _i9.Future dispatchPointerEvent(_i12.PointerEvent? event) => (super.noSuchMethod( Invocation.method( #dispatchPointerEvent, @@ -1988,7 +2028,7 @@ class MockWebView extends _i1.Mock implements _i2.WebView { @override _i9.Future postUrl( String? url, - _i14.Uint8List? data, + _i13.Uint8List? data, ) => (super.noSuchMethod( Invocation.method( @@ -2403,7 +2443,7 @@ class MockInstanceManager extends _i1.Mock implements _i5.InstanceManager { /// /// See the documentation for Mockito's code generation for more information. class MockTestInstanceManagerHostApi extends _i1.Mock - implements _i15.TestInstanceManagerHostApi { + implements _i14.TestInstanceManagerHostApi { @override void clear() => super.noSuchMethod( Invocation.method( diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart index ce56715aa1fb..2e0e83b848b0 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart @@ -473,6 +473,23 @@ class MockAndroidWebViewController extends _i1.Mock returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override + _i5.Future setCustomViewCallbacks({ + _i6.OnShowCustomViewCallback? onShowCustomView, + _i6.OnHideCustomViewCallback? onHideCustomView, + }) => + (super.noSuchMethod( + Invocation.method( + #setCustomViewCallbacks, + [], + { + #onShowCustomView: onShowCustomView, + #onHideCustomView: onHideCustomView, + }, + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); } /// A class which mocks [TestInstanceManagerHostApi]. diff --git a/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart index 98060e042f9b..0989cb63b423 100644 --- a/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart +++ b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart @@ -15,8 +15,7 @@ import 'package:webview_flutter_android/src/android_webview.g.dart'; /// Host API for managing the native `InstanceManager`. abstract class TestInstanceManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Clear the native `InstanceManager`. @@ -24,19 +23,15 @@ abstract class TestInstanceManagerHostApi { /// This is typically only used after a hot restart. void clear(); - static void setup(TestInstanceManagerHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestInstanceManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.InstanceManagerHostApi.clear', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { // ignore message api.clear(); return []; @@ -52,27 +47,22 @@ abstract class TestInstanceManagerHostApi { /// /// See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. abstract class TestJavaObjectHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void dispose(int identifier); - static void setup(TestJavaObjectHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestJavaObjectHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaObjectHostApi.dispose', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -91,8 +81,7 @@ abstract class TestJavaObjectHostApi { /// are attached to a Dart instance or handle method calls on the associated /// native class or an instance of the class. abstract class TestCookieManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Handles attaching `CookieManager.instance` to a native instance. @@ -105,24 +94,19 @@ abstract class TestCookieManagerHostApi { Future removeAllCookies(int identifier); /// Handles Dart method `CookieManager.setAcceptThirdPartyCookies`. - void setAcceptThirdPartyCookies( - int identifier, int webViewIdentifier, bool accept); + void setAcceptThirdPartyCookies(int identifier, int webViewIdentifier, bool accept); - static void setup(TestCookieManagerHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestCookieManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CookieManagerHostApi.attachInstance', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CookieManagerHostApi.attachInstance was null.'); + 'Argument for dev.flutter.pigeon.CookieManagerHostApi.attachInstance was null.'); final List args = (message as List?)!; final int? arg_instanceIdentifier = (args[0] as int?); assert(arg_instanceIdentifier != null, @@ -137,14 +121,11 @@ abstract class TestCookieManagerHostApi { 'dev.flutter.pigeon.CookieManagerHostApi.setCookie', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setCookie was null.'); + 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setCookie was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -165,14 +146,11 @@ abstract class TestCookieManagerHostApi { 'dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies was null.'); + 'Argument for dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -184,18 +162,14 @@ abstract class TestCookieManagerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies', - codec, + 'dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies was null.'); + 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -206,8 +180,7 @@ abstract class TestCookieManagerHostApi { final bool? arg_accept = (args[2] as bool?); assert(arg_accept != null, 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies was null, expected non-null bool.'); - api.setAcceptThirdPartyCookies( - arg_identifier!, arg_webViewIdentifier!, arg_accept!); + api.setAcceptThirdPartyCookies(arg_identifier!, arg_webViewIdentifier!, arg_accept!); return []; }); } @@ -217,7 +190,6 @@ abstract class TestCookieManagerHostApi { class _TestWebViewHostApiCodec extends StandardMessageCodec { const _TestWebViewHostApiCodec(); - @override void writeValue(WriteBuffer buffer, Object? value) { if (value is WebViewPoint) { @@ -231,7 +203,7 @@ class _TestWebViewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebViewPoint.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -240,17 +212,14 @@ class _TestWebViewHostApiCodec extends StandardMessageCodec { } abstract class TestWebViewHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestWebViewHostApiCodec(); void create(int instanceId); - void loadData( - int instanceId, String data, String? mimeType, String? encoding); + void loadData(int instanceId, String data, String? mimeType, String? encoding); - void loadDataWithBaseUrl(int instanceId, String? baseUrl, String data, - String? mimeType, String? encoding, String? historyUrl); + void loadDataWithBaseUrl(int instanceId, String? baseUrl, String data, String? mimeType, String? encoding, String? historyUrl); void loadUrl(int instanceId, String url, Map headers); @@ -298,21 +267,17 @@ abstract class TestWebViewHostApi { void setBackgroundColor(int instanceId, int color); - static void setup(TestWebViewHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebViewHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -327,14 +292,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.loadData', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -354,14 +316,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -373,8 +332,7 @@ abstract class TestWebViewHostApi { final String? arg_mimeType = (args[3] as String?); final String? arg_encoding = (args[4] as String?); final String? arg_historyUrl = (args[5] as String?); - api.loadDataWithBaseUrl(arg_instanceId!, arg_baseUrl, arg_data!, - arg_mimeType, arg_encoding, arg_historyUrl); + api.loadDataWithBaseUrl(arg_instanceId!, arg_baseUrl, arg_data!, arg_mimeType, arg_encoding, arg_historyUrl); return []; }); } @@ -384,14 +342,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.loadUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -399,8 +354,7 @@ abstract class TestWebViewHostApi { final String? arg_url = (args[1] as String?); assert(arg_url != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null String.'); - final Map? arg_headers = - (args[2] as Map?)?.cast(); + final Map? arg_headers = (args[2] as Map?)?.cast(); assert(arg_headers != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null Map.'); api.loadUrl(arg_instanceId!, arg_url!, arg_headers!); @@ -413,14 +367,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.postUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -441,14 +392,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -463,14 +411,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.canGoBack', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoBack was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -485,14 +430,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.canGoForward', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoForward was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -507,14 +449,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.goBack', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.goBack was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.goBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -529,14 +468,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.goForward', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.goForward was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.goForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -551,14 +487,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.reload', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.reload was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.reload was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -573,14 +506,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.clearCache', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -598,14 +528,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.evaluateJavascript', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -613,8 +540,7 @@ abstract class TestWebViewHostApi { final String? arg_javascriptString = (args[1] as String?); assert(arg_javascriptString != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null, expected non-null String.'); - final String? output = await api.evaluateJavascript( - arg_instanceId!, arg_javascriptString!); + final String? output = await api.evaluateJavascript(arg_instanceId!, arg_javascriptString!); return [output]; }); } @@ -624,14 +550,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getTitle', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getTitle was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getTitle was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -646,14 +569,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.scrollTo', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -674,14 +594,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.scrollBy', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -702,14 +619,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getScrollX', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollX was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollX was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -724,14 +638,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getScrollY', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollY was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollY was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -746,14 +657,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getScrollPosition', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollPosition was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollPosition was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -765,18 +673,14 @@ abstract class TestWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', - codec, + 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled was null.'); final List args = (message as List?)!; final bool? arg_enabled = (args[0] as bool?); assert(arg_enabled != null, @@ -791,14 +695,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setWebViewClient', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -816,14 +717,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -831,8 +729,7 @@ abstract class TestWebViewHostApi { final int? arg_javaScriptChannelInstanceId = (args[1] as int?); assert(arg_javaScriptChannelInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null, expected non-null int.'); - api.addJavaScriptChannel( - arg_instanceId!, arg_javaScriptChannelInstanceId!); + api.addJavaScriptChannel(arg_instanceId!, arg_javaScriptChannelInstanceId!); return []; }); } @@ -842,14 +739,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -857,8 +751,7 @@ abstract class TestWebViewHostApi { final int? arg_javaScriptChannelInstanceId = (args[1] as int?); assert(arg_javaScriptChannelInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null, expected non-null int.'); - api.removeJavaScriptChannel( - arg_instanceId!, arg_javaScriptChannelInstanceId!); + api.removeJavaScriptChannel(arg_instanceId!, arg_javaScriptChannelInstanceId!); return []; }); } @@ -868,14 +761,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setDownloadListener', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -891,14 +781,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setWebChromeClient', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -914,14 +801,11 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setBackgroundColor', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -938,8 +822,7 @@ abstract class TestWebViewHostApi { } abstract class TestWebSettingsHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId, int webViewInstanceId); @@ -970,21 +853,17 @@ abstract class TestWebSettingsHostApi { void setTextZoom(int instanceId, int textZoom); - static void setup(TestWebSettingsHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebSettingsHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1002,14 +881,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1024,18 +900,14 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1043,26 +915,21 @@ abstract class TestWebSettingsHostApi { final bool? arg_flag = (args[1] as bool?); assert(arg_flag != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null, expected non-null bool.'); - api.setJavaScriptCanOpenWindowsAutomatically( - arg_instanceId!, arg_flag!); + api.setJavaScriptCanOpenWindowsAutomatically(arg_instanceId!, arg_flag!); return []; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1080,14 +947,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1105,14 +969,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1125,18 +986,14 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1144,8 +1001,7 @@ abstract class TestWebSettingsHostApi { final bool? arg_require = (args[1] as bool?); assert(arg_require != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null, expected non-null bool.'); - api.setMediaPlaybackRequiresUserGesture( - arg_instanceId!, arg_require!); + api.setMediaPlaybackRequiresUserGesture(arg_instanceId!, arg_require!); return []; }); } @@ -1155,14 +1011,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1177,18 +1030,14 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', - codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1206,14 +1055,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1231,14 +1077,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1256,14 +1099,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1281,14 +1121,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1306,14 +1143,11 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setTextZoom', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setTextZoom was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setTextZoom was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1330,27 +1164,22 @@ abstract class TestWebSettingsHostApi { } abstract class TestJavaScriptChannelHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId, String channelName); - static void setup(TestJavaScriptChannelHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestJavaScriptChannelHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1367,30 +1196,24 @@ abstract class TestJavaScriptChannelHostApi { } abstract class TestWebViewClientHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - void setSynchronousReturnValueForShouldOverrideUrlLoading( - int instanceId, bool value); + void setSynchronousReturnValueForShouldOverrideUrlLoading(int instanceId, bool value); - static void setup(TestWebViewClientHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebViewClientHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewClientHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1402,18 +1225,14 @@ abstract class TestWebViewClientHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', - codec, + 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1421,8 +1240,7 @@ abstract class TestWebViewClientHostApi { final bool? arg_value = (args[1] as bool?); assert(arg_value != null, 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null, expected non-null bool.'); - api.setSynchronousReturnValueForShouldOverrideUrlLoading( - arg_instanceId!, arg_value!); + api.setSynchronousReturnValueForShouldOverrideUrlLoading(arg_instanceId!, arg_value!); return []; }); } @@ -1431,27 +1249,22 @@ abstract class TestWebViewClientHostApi { } abstract class TestDownloadListenerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - static void setup(TestDownloadListenerHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestDownloadListenerHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.DownloadListenerHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.DownloadListenerHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.DownloadListenerHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1465,30 +1278,24 @@ abstract class TestDownloadListenerHostApi { } abstract class TestWebChromeClientHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - void setSynchronousReturnValueForOnShowFileChooser( - int instanceId, bool value); + void setSynchronousReturnValueForOnShowFileChooser(int instanceId, bool value); - static void setup(TestWebChromeClientHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebChromeClientHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebChromeClientHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1500,18 +1307,14 @@ abstract class TestWebChromeClientHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', - codec, + 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1519,8 +1322,7 @@ abstract class TestWebChromeClientHostApi { final bool? arg_value = (args[1] as bool?); assert(arg_value != null, 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null, expected non-null bool.'); - api.setSynchronousReturnValueForOnShowFileChooser( - arg_instanceId!, arg_value!); + api.setSynchronousReturnValueForOnShowFileChooser(arg_instanceId!, arg_value!); return []; }); } @@ -1529,29 +1331,24 @@ abstract class TestWebChromeClientHostApi { } abstract class TestAssetManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); List list(String path); String getAssetFilePathByName(String name); - static void setup(TestAssetManagerHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestAssetManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FlutterAssetManagerHostApi.list', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.list was null.'); + 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.list was null.'); final List args = (message as List?)!; final String? arg_path = (args[0] as String?); assert(arg_path != null, @@ -1563,18 +1360,14 @@ abstract class TestAssetManagerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', - codec, + 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName was null.'); + 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName was null.'); final List args = (message as List?)!; final String? arg_name = (args[0] as String?); assert(arg_name != null, @@ -1588,29 +1381,24 @@ abstract class TestAssetManagerHostApi { } abstract class TestWebStorageHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); void deleteAllData(int instanceId); - static void setup(TestWebStorageHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebStorageHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebStorageHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebStorageHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebStorageHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1625,14 +1413,11 @@ abstract class TestWebStorageHostApi { 'dev.flutter.pigeon.WebStorageHostApi.deleteAllData', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebStorageHostApi.deleteAllData was null.'); + 'Argument for dev.flutter.pigeon.WebStorageHostApi.deleteAllData was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1653,8 +1438,7 @@ abstract class TestWebStorageHostApi { /// /// See https://developer.android.com/reference/android/webkit/PermissionRequest. abstract class TestPermissionRequestHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Handles Dart method `PermissionRequest.grant`. @@ -1663,27 +1447,22 @@ abstract class TestPermissionRequestHostApi { /// Handles Dart method `PermissionRequest.deny`. void deny(int instanceId); - static void setup(TestPermissionRequestHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestPermissionRequestHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PermissionRequestHostApi.grant', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null.'); + 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null, expected non-null int.'); - final List? arg_resources = - (args[1] as List?)?.cast(); + final List? arg_resources = (args[1] as List?)?.cast(); assert(arg_resources != null, 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null, expected non-null List.'); api.grant(arg_instanceId!, arg_resources!); @@ -1696,14 +1475,11 @@ abstract class TestPermissionRequestHostApi { 'dev.flutter.pigeon.PermissionRequestHostApi.deny', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.deny was null.'); + 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.deny was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1716,6 +1492,43 @@ abstract class TestPermissionRequestHostApi { } } +/// Host API for `CustomViewCallback`. +/// +/// This class may handle instantiating and adding native object instances that +/// are attached to a Dart instance or handle method calls on the associated +/// native class or an instance of the class. +/// +/// See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. +abstract class TestCustomViewCallbackHostApi { + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static const MessageCodec codec = StandardMessageCodec(); + + /// Handles Dart method `CustomViewCallback.onCustomViewHidden`. + void onCustomViewHidden(int identifier); + + static void setup(TestCustomViewCallbackHostApi? api, {BinaryMessenger? binaryMessenger}) { + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden', codec, + binaryMessenger: binaryMessenger); + if (api == null) { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + } else { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden was null.'); + final List args = (message as List?)!; + final int? arg_identifier = (args[0] as int?); + assert(arg_identifier != null, + 'Argument for dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden was null, expected non-null int.'); + api.onCustomViewHidden(arg_identifier!); + return []; + }); + } + } + } +} + /// Host API for `GeolocationPermissionsCallback`. /// /// This class may handle instantiating and adding native object instances that @@ -1724,29 +1537,23 @@ abstract class TestPermissionRequestHostApi { /// /// See https://developer.android.com/reference/android/webkit/GeolocationPermissions.Callback. abstract class TestGeolocationPermissionsCallbackHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => - TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Handles Dart method `GeolocationPermissionsCallback.invoke`. void invoke(int instanceId, String origin, bool allow, bool retain); - static void setup(TestGeolocationPermissionsCallbackHostApi? api, - {BinaryMessenger? binaryMessenger}) { + static void setup(TestGeolocationPermissionsCallbackHostApi? api, {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.GeolocationPermissionsCallbackHostApi.invoke', - codec, + 'dev.flutter.pigeon.GeolocationPermissionsCallbackHostApi.invoke', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger - .setMockDecodedMessageHandler(channel, - (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.GeolocationPermissionsCallbackHostApi.invoke was null.'); + 'Argument for dev.flutter.pigeon.GeolocationPermissionsCallbackHostApi.invoke was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, From 216757e51b52d0931c61894efc7dccd6f0ad67cb Mon Sep 17 00:00:00 2001 From: Maurits van Beusekom Date: Thu, 6 Jul 2023 17:18:49 +0200 Subject: [PATCH 19/35] Adds Android fullscreen functionality --- packages/webview_flutter/webview_flutter_android/CHANGELOG.md | 2 +- .../lib/src/android_webview_controller.dart | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md index c7773430bef5..26146353560a 100644 --- a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md @@ -1,6 +1,6 @@ ## 3.9.0 -* Adds support for fullscreen video. +* Adds support for playing video in fullscreen. ## 3.8.1 diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart index 74a8d4aef109..5511cc6aa642 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart @@ -974,7 +974,9 @@ class AndroidCustomViewWidget extends StatelessWidget { view: _creationParams.customView, instanceManager: _creationParams.instanceManager, layoutDirection: _creationParams.layoutDirection, - ); + ) + ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated) + ..create(); }, ); } From afe0b8f7e6e59391dd495b88c5356d3f60ec6a3a Mon Sep 17 00:00:00 2001 From: Maurits van Beusekom Date: Tue, 11 Jul 2023 10:50:27 +0200 Subject: [PATCH 20/35] Apply review feedback --- .../GeneratedAndroidWebView.java | 982 +++++++++++------- .../webviewflutter/WebChromeClientTest.java | 3 - .../example/lib/main.dart | 30 +- .../lib/src/android_webview.g.dart | 450 +++++--- .../lib/src/android_webview_controller.dart | 52 +- .../test/android_webview_controller_test.dart | 8 +- ...android_webview_controller_test.mocks.dart | 12 +- ...oid_webview_cookie_manager_test.mocks.dart | 12 +- .../test/test_android_webview.g.dart | 705 ++++++++----- 9 files changed, 1440 insertions(+), 814 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java index a717f3fa102b..383544ea74c3 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java @@ -18,7 +18,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -35,8 +34,7 @@ public static class FlutterError extends RuntimeException { /** The error details. Must be a datatype supported by the api codec. */ public final Object details; - public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) - { + public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) { super(message); this.code = code; this.details = details; @@ -55,7 +53,7 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { errorList.add(exception.toString()); errorList.add(exception.getClass().getSimpleName()); errorList.add( - "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); + "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception)); } return errorList; } @@ -63,26 +61,29 @@ protected static ArrayList wrapError(@NonNull Throwable exception) { /** * Mode of how to select files for a file chooser. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. */ public enum FileChooserMode { /** - * Open single file and requires that the file exists before allowing the - * user to pick it. + * Open single file and requires that the file exists before allowing the user to pick it. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN. + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN. */ OPEN(0), /** * Similar to [open] but allows multiple files to be selected. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE. + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE. */ OPEN_MULTIPLE(1), /** * Allows picking a nonexistent file and saving it. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE. + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE. */ SAVE(2); @@ -374,7 +375,10 @@ ArrayList toList() { static @NonNull WebResourceErrorData fromList(@NonNull ArrayList list) { WebResourceErrorData pigeonResult = new WebResourceErrorData(); Object errorCode = list.get(0); - pigeonResult.setErrorCode((errorCode == null) ? null : ((errorCode instanceof Integer) ? (Integer) errorCode : (Long) errorCode)); + pigeonResult.setErrorCode( + (errorCode == null) + ? null + : ((errorCode instanceof Integer) ? (Integer) errorCode : (Long) errorCode)); Object description = list.get(1); pigeonResult.setDescription((String) description); return pigeonResult; @@ -463,13 +467,13 @@ public interface Result { /** * Host API for managing the native `InstanceManager`. * - * Generated interface from Pigeon that represents a handler of messages from Flutter. + *

Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface InstanceManagerHostApi { /** * Clear the native `InstanceManager`. * - * This is typically only used after a hot restart. + *

This is typically only used after a hot restart. */ void clear(); @@ -477,8 +481,12 @@ public interface InstanceManagerHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `InstanceManagerHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable InstanceManagerHostApi api) { + /** + * Sets up an instance of `InstanceManagerHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable InstanceManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -490,8 +498,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable InstanceMa try { api.clear(); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -506,11 +513,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable InstanceMa /** * Handles methods calls to the native Java Object class. * - * Also handles calls to remove the reference to an instance with `dispose`. + *

Also handles calls to remove the reference to an instance with `dispose`. * - * See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. + *

See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. * - * Generated interface from Pigeon that represents a handler of messages from Flutter. + *

Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface JavaObjectHostApi { @@ -520,7 +527,9 @@ public interface JavaObjectHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObjectHostApi api) { { BasicMessageChannel channel = @@ -535,8 +544,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObject try { api.dispose((identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -551,9 +559,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObject /** * Handles callbacks methods for the native Java Object class. * - * See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. + *

See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. * - * Generated class from Pigeon that represents Flutter messages that can be called from Java. + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class JavaObjectFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -562,7 +570,7 @@ public JavaObjectFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -571,6 +579,7 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } + public void dispose(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -583,11 +592,11 @@ public void dispose(@NonNull Long identifierArg, @NonNull Reply callback) /** * Host API for `CookieManager`. * - * This class may handle instantiating and adding native object instances that - * are attached to a Dart instance or handle method calls on the associated - * native class or an instance of the class. + *

This class may handle instantiating and adding native object instances that are attached to + * a Dart instance or handle method calls on the associated native class or an instance of the + * class. * - * Generated interface from Pigeon that represents a handler of messages from Flutter. + *

Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CookieManagerHostApi { /** Handles attaching `CookieManager.instance` to a native instance. */ @@ -597,18 +606,25 @@ public interface CookieManagerHostApi { /** Handles Dart method `CookieManager.removeAllCookies`. */ void removeAllCookies(@NonNull Long identifier, @NonNull Result result); /** Handles Dart method `CookieManager.setAcceptThirdPartyCookies`. */ - void setAcceptThirdPartyCookies(@NonNull Long identifier, @NonNull Long webViewIdentifier, @NonNull Boolean accept); + void setAcceptThirdPartyCookies( + @NonNull Long identifier, @NonNull Long webViewIdentifier, @NonNull Boolean accept); /** The codec used by CookieManagerHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `CookieManagerHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CookieManagerHostApi api) { + /** + * Sets up an instance of `CookieManagerHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable CookieManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.CookieManagerHostApi.attachInstance", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.CookieManagerHostApi.attachInstance", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -616,10 +632,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CookieMana ArrayList args = (ArrayList) message; Number instanceIdentifierArg = (Number) args.get(0); try { - api.attachInstance((instanceIdentifierArg == null) ? null : instanceIdentifierArg.longValue()); + api.attachInstance( + (instanceIdentifierArg == null) ? null : instanceIdentifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -642,10 +658,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CookieMana String urlArg = (String) args.get(1); String valueArg = (String) args.get(2); try { - api.setCookie((identifierArg == null) ? null : identifierArg.longValue(), urlArg, valueArg); + api.setCookie( + (identifierArg == null) ? null : identifierArg.longValue(), urlArg, valueArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -658,7 +674,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CookieMana { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -678,7 +696,8 @@ public void error(Throwable error) { } }; - api.removeAllCookies((identifierArg == null) ? null : identifierArg.longValue(), resultCallback); + api.removeAllCookies( + (identifierArg == null) ? null : identifierArg.longValue(), resultCallback); }); } else { channel.setMessageHandler(null); @@ -687,7 +706,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -697,10 +718,12 @@ public void error(Throwable error) { Number webViewIdentifierArg = (Number) args.get(1); Boolean acceptArg = (Boolean) args.get(2); try { - api.setAcceptThirdPartyCookies((identifierArg == null) ? null : identifierArg.longValue(), (webViewIdentifierArg == null) ? null : webViewIdentifierArg.longValue(), acceptArg); + api.setAcceptThirdPartyCookies( + (identifierArg == null) ? null : identifierArg.longValue(), + (webViewIdentifierArg == null) ? null : webViewIdentifierArg.longValue(), + acceptArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -744,21 +767,32 @@ public interface WebViewHostApi { void create(@NonNull Long instanceId); - void loadData(@NonNull Long instanceId, @NonNull String data, @Nullable String mimeType, @Nullable String encoding); + void loadData( + @NonNull Long instanceId, + @NonNull String data, + @Nullable String mimeType, + @Nullable String encoding); - void loadDataWithBaseUrl(@NonNull Long instanceId, @Nullable String baseUrl, @NonNull String data, @Nullable String mimeType, @Nullable String encoding, @Nullable String historyUrl); + void loadDataWithBaseUrl( + @NonNull Long instanceId, + @Nullable String baseUrl, + @NonNull String data, + @Nullable String mimeType, + @Nullable String encoding, + @Nullable String historyUrl); - void loadUrl(@NonNull Long instanceId, @NonNull String url, @NonNull Map headers); + void loadUrl( + @NonNull Long instanceId, @NonNull String url, @NonNull Map headers); void postUrl(@NonNull Long instanceId, @NonNull String url, @NonNull byte[] data); - @Nullable + @Nullable String getUrl(@NonNull Long instanceId); - @NonNull + @NonNull Boolean canGoBack(@NonNull Long instanceId); - @NonNull + @NonNull Boolean canGoForward(@NonNull Long instanceId); void goBack(@NonNull Long instanceId); @@ -769,22 +803,23 @@ public interface WebViewHostApi { void clearCache(@NonNull Long instanceId, @NonNull Boolean includeDiskFiles); - void evaluateJavascript(@NonNull Long instanceId, @NonNull String javascriptString, @NonNull Result result); + void evaluateJavascript( + @NonNull Long instanceId, @NonNull String javascriptString, @NonNull Result result); - @Nullable + @Nullable String getTitle(@NonNull Long instanceId); void scrollTo(@NonNull Long instanceId, @NonNull Long x, @NonNull Long y); void scrollBy(@NonNull Long instanceId, @NonNull Long x, @NonNull Long y); - @NonNull + @NonNull Long getScrollX(@NonNull Long instanceId); - @NonNull + @NonNull Long getScrollY(@NonNull Long instanceId); - @NonNull + @NonNull WebViewPoint getScrollPosition(@NonNull Long instanceId); void setWebContentsDebuggingEnabled(@NonNull Boolean enabled); @@ -793,7 +828,8 @@ public interface WebViewHostApi { void addJavaScriptChannel(@NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId); - void removeJavaScriptChannel(@NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId); + void removeJavaScriptChannel( + @NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId); void setDownloadListener(@NonNull Long instanceId, @Nullable Long listenerInstanceId); @@ -805,7 +841,7 @@ public interface WebViewHostApi { static @NonNull MessageCodec getCodec() { return WebViewHostApiCodec.INSTANCE; } - /**Sets up an instance of `WebViewHostApi` to handle messages through the `binaryMessenger`. */ + /** Sets up an instance of `WebViewHostApi` to handle messages through the `binaryMessenger`. */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHostApi api) { { BasicMessageChannel channel = @@ -820,8 +856,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -845,10 +880,13 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos String mimeTypeArg = (String) args.get(2); String encodingArg = (String) args.get(3); try { - api.loadData((instanceIdArg == null) ? null : instanceIdArg.longValue(), dataArg, mimeTypeArg, encodingArg); + api.loadData( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + dataArg, + mimeTypeArg, + encodingArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -861,7 +899,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -874,10 +914,15 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos String encodingArg = (String) args.get(4); String historyUrlArg = (String) args.get(5); try { - api.loadDataWithBaseUrl((instanceIdArg == null) ? null : instanceIdArg.longValue(), baseUrlArg, dataArg, mimeTypeArg, encodingArg, historyUrlArg); + api.loadDataWithBaseUrl( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + baseUrlArg, + dataArg, + mimeTypeArg, + encodingArg, + historyUrlArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -900,10 +945,12 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos String urlArg = (String) args.get(1); Map headersArg = (Map) args.get(2); try { - api.loadUrl((instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, headersArg); + api.loadUrl( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + urlArg, + headersArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -926,10 +973,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos String urlArg = (String) args.get(1); byte[] dataArg = (byte[]) args.get(2); try { - api.postUrl((instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, dataArg); + api.postUrl( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, dataArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -950,10 +997,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - String output = api.getUrl((instanceIdArg == null) ? null : instanceIdArg.longValue()); + String output = + api.getUrl((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -974,10 +1021,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - Boolean output = api.canGoBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); + Boolean output = + api.canGoBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -998,10 +1045,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - Boolean output = api.canGoForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); + Boolean output = + api.canGoForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1024,8 +1071,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos try { api.goBack((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1048,8 +1094,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos try { api.goForward((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1072,8 +1117,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos try { api.reload((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1095,10 +1139,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos Number instanceIdArg = (Number) args.get(0); Boolean includeDiskFilesArg = (Boolean) args.get(1); try { - api.clearCache((instanceIdArg == null) ? null : instanceIdArg.longValue(), includeDiskFilesArg); + api.clearCache( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + includeDiskFilesArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1111,7 +1156,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHos { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.evaluateJavascript", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.evaluateJavascript", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1132,7 +1179,10 @@ public void error(Throwable error) { } }; - api.evaluateJavascript((instanceIdArg == null) ? null : instanceIdArg.longValue(), javascriptStringArg, resultCallback); + api.evaluateJavascript( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + javascriptStringArg, + resultCallback); }); } else { channel.setMessageHandler(null); @@ -1149,10 +1199,10 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - String output = api.getTitle((instanceIdArg == null) ? null : instanceIdArg.longValue()); + String output = + api.getTitle((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1175,10 +1225,12 @@ public void error(Throwable error) { Number xArg = (Number) args.get(1); Number yArg = (Number) args.get(2); try { - api.scrollTo((instanceIdArg == null) ? null : instanceIdArg.longValue(), (xArg == null) ? null : xArg.longValue(), (yArg == null) ? null : yArg.longValue()); + api.scrollTo( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (xArg == null) ? null : xArg.longValue(), + (yArg == null) ? null : yArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1201,10 +1253,12 @@ public void error(Throwable error) { Number xArg = (Number) args.get(1); Number yArg = (Number) args.get(2); try { - api.scrollBy((instanceIdArg == null) ? null : instanceIdArg.longValue(), (xArg == null) ? null : xArg.longValue(), (yArg == null) ? null : yArg.longValue()); + api.scrollBy( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (xArg == null) ? null : xArg.longValue(), + (yArg == null) ? null : yArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1225,10 +1279,10 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - Long output = api.getScrollX((instanceIdArg == null) ? null : instanceIdArg.longValue()); + Long output = + api.getScrollX((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1249,10 +1303,10 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - Long output = api.getScrollY((instanceIdArg == null) ? null : instanceIdArg.longValue()); + Long output = + api.getScrollY((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1273,10 +1327,11 @@ public void error(Throwable error) { ArrayList args = (ArrayList) message; Number instanceIdArg = (Number) args.get(0); try { - WebViewPoint output = api.getScrollPosition((instanceIdArg == null) ? null : instanceIdArg.longValue()); + WebViewPoint output = + api.getScrollPosition( + (instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1289,7 +1344,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1299,8 +1356,7 @@ public void error(Throwable error) { try { api.setWebContentsDebuggingEnabled(enabledArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1322,10 +1378,13 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number webViewClientInstanceIdArg = (Number) args.get(1); try { - api.setWebViewClient((instanceIdArg == null) ? null : instanceIdArg.longValue(), (webViewClientInstanceIdArg == null) ? null : webViewClientInstanceIdArg.longValue()); + api.setWebViewClient( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (webViewClientInstanceIdArg == null) + ? null + : webViewClientInstanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1338,7 +1397,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1347,10 +1408,13 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number javaScriptChannelInstanceIdArg = (Number) args.get(1); try { - api.addJavaScriptChannel((instanceIdArg == null) ? null : instanceIdArg.longValue(), (javaScriptChannelInstanceIdArg == null) ? null : javaScriptChannelInstanceIdArg.longValue()); + api.addJavaScriptChannel( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (javaScriptChannelInstanceIdArg == null) + ? null + : javaScriptChannelInstanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1363,7 +1427,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1372,10 +1438,13 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number javaScriptChannelInstanceIdArg = (Number) args.get(1); try { - api.removeJavaScriptChannel((instanceIdArg == null) ? null : instanceIdArg.longValue(), (javaScriptChannelInstanceIdArg == null) ? null : javaScriptChannelInstanceIdArg.longValue()); + api.removeJavaScriptChannel( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (javaScriptChannelInstanceIdArg == null) + ? null + : javaScriptChannelInstanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1388,7 +1457,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setDownloadListener", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.setDownloadListener", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1397,10 +1468,11 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number listenerInstanceIdArg = (Number) args.get(1); try { - api.setDownloadListener((instanceIdArg == null) ? null : instanceIdArg.longValue(), (listenerInstanceIdArg == null) ? null : listenerInstanceIdArg.longValue()); + api.setDownloadListener( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (listenerInstanceIdArg == null) ? null : listenerInstanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1413,7 +1485,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setWebChromeClient", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.setWebChromeClient", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1422,10 +1496,11 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number clientInstanceIdArg = (Number) args.get(1); try { - api.setWebChromeClient((instanceIdArg == null) ? null : instanceIdArg.longValue(), (clientInstanceIdArg == null) ? null : clientInstanceIdArg.longValue()); + api.setWebChromeClient( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (clientInstanceIdArg == null) ? null : clientInstanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1438,7 +1513,9 @@ public void error(Throwable error) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewHostApi.setBackgroundColor", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewHostApi.setBackgroundColor", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1447,10 +1524,11 @@ public void error(Throwable error) { Number instanceIdArg = (Number) args.get(0); Number colorArg = (Number) args.get(1); try { - api.setBackgroundColor((instanceIdArg == null) ? null : instanceIdArg.longValue(), (colorArg == null) ? null : colorArg.longValue()); + api.setBackgroundColor( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (colorArg == null) ? null : colorArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1465,13 +1543,12 @@ public void error(Throwable error) { /** * Flutter API for `WebView`. * - * This class may handle instantiating and adding Dart instances that are - * attached to a native instance or receiving callback methods from an - * overridden native class. + *

This class may handle instantiating and adding Dart instances that are attached to a native + * instance or receiving callback methods from an overridden native class. * - * See https://developer.android.com/reference/android/webkit/WebView. + *

See https://developer.android.com/reference/android/webkit/WebView. * - * Generated class from Pigeon that represents Flutter messages that can be called from Java. + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class WebViewFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -1480,7 +1557,7 @@ public WebViewFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1534,7 +1611,9 @@ public interface WebSettingsHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `WebSettingsHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `WebSettingsHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSettingsHostApi api) { { BasicMessageChannel channel = @@ -1548,10 +1627,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Number webViewInstanceIdArg = (Number) args.get(1); try { - api.create((instanceIdArg == null) ? null : instanceIdArg.longValue(), (webViewInstanceIdArg == null) ? null : webViewInstanceIdArg.longValue()); + api.create( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (webViewInstanceIdArg == null) ? null : webViewInstanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1564,7 +1644,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1573,10 +1655,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean flagArg = (Boolean) args.get(1); try { - api.setDomStorageEnabled((instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); + api.setDomStorageEnabled( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1589,7 +1671,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1598,10 +1682,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean flagArg = (Boolean) args.get(1); try { - api.setJavaScriptCanOpenWindowsAutomatically((instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); + api.setJavaScriptCanOpenWindowsAutomatically( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1614,7 +1698,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1623,10 +1709,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean supportArg = (Boolean) args.get(1); try { - api.setSupportMultipleWindows((instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); + api.setSupportMultipleWindows( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1639,7 +1725,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1648,10 +1736,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean flagArg = (Boolean) args.get(1); try { - api.setJavaScriptEnabled((instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); + api.setJavaScriptEnabled( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1664,7 +1752,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1673,10 +1763,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); String userAgentStringArg = (String) args.get(1); try { - api.setUserAgentString((instanceIdArg == null) ? null : instanceIdArg.longValue(), userAgentStringArg); + api.setUserAgentString( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + userAgentStringArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1689,7 +1780,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1698,10 +1791,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean requireArg = (Boolean) args.get(1); try { - api.setMediaPlaybackRequiresUserGesture((instanceIdArg == null) ? null : instanceIdArg.longValue(), requireArg); + api.setMediaPlaybackRequiresUserGesture( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), requireArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1714,7 +1807,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1723,10 +1818,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean supportArg = (Boolean) args.get(1); try { - api.setSupportZoom((instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); + api.setSupportZoom( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1739,7 +1834,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1748,10 +1845,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean overviewArg = (Boolean) args.get(1); try { - api.setLoadWithOverviewMode((instanceIdArg == null) ? null : instanceIdArg.longValue(), overviewArg); + api.setLoadWithOverviewMode( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), overviewArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1764,7 +1861,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1773,10 +1872,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean useArg = (Boolean) args.get(1); try { - api.setUseWideViewPort((instanceIdArg == null) ? null : instanceIdArg.longValue(), useArg); + api.setUseWideViewPort( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), useArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1789,7 +1888,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1798,10 +1899,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean enabledArg = (Boolean) args.get(1); try { - api.setDisplayZoomControls((instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); + api.setDisplayZoomControls( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1814,7 +1915,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1823,10 +1926,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean enabledArg = (Boolean) args.get(1); try { - api.setBuiltInZoomControls((instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); + api.setBuiltInZoomControls( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1839,7 +1942,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -1848,10 +1953,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Boolean enabledArg = (Boolean) args.get(1); try { - api.setAllowFileAccess((instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); + api.setAllowFileAccess( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1873,10 +1978,11 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSetting Number instanceIdArg = (Number) args.get(0); Number textZoomArg = (Number) args.get(1); try { - api.setTextZoom((instanceIdArg == null) ? null : instanceIdArg.longValue(), (textZoomArg == null) ? null : textZoomArg.longValue()); + api.setTextZoom( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + (textZoomArg == null) ? null : textZoomArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1897,8 +2003,12 @@ public interface JavaScriptChannelHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `JavaScriptChannelHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaScriptChannelHostApi api) { + /** + * Sets up an instance of `JavaScriptChannelHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable JavaScriptChannelHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1911,10 +2021,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaScript Number instanceIdArg = (Number) args.get(0); String channelNameArg = (String) args.get(1); try { - api.create((instanceIdArg == null) ? null : instanceIdArg.longValue(), channelNameArg); + api.create( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), channelNameArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1934,7 +2044,7 @@ public JavaScriptChannelFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -1943,10 +2053,14 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void postMessage(@NonNull Long instanceIdArg, @NonNull String messageArg, @NonNull Reply callback) { + + public void postMessage( + @NonNull Long instanceIdArg, @NonNull String messageArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage", + getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, messageArg)), channelReply -> callback.reply(null)); @@ -1957,14 +2071,19 @@ public interface WebViewClientHostApi { void create(@NonNull Long instanceId); - void setSynchronousReturnValueForShouldOverrideUrlLoading(@NonNull Long instanceId, @NonNull Boolean value); + void setSynchronousReturnValueForShouldOverrideUrlLoading( + @NonNull Long instanceId, @NonNull Boolean value); /** The codec used by WebViewClientHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `WebViewClientHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewClientHostApi api) { + /** + * Sets up an instance of `WebViewClientHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable WebViewClientHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -1978,8 +2097,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewCli try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -1992,7 +2110,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewCli { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2001,10 +2121,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewCli Number instanceIdArg = (Number) args.get(0); Boolean valueArg = (Boolean) args.get(1); try { - api.setSynchronousReturnValueForShouldOverrideUrlLoading((instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); + api.setSynchronousReturnValueForShouldOverrideUrlLoading( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2056,7 +2176,7 @@ public WebViewClientFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2065,47 +2185,97 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return WebViewClientFlutterApiCodec.INSTANCE; } - public void onPageStarted(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Reply callback) { + + public void onPageStarted( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull String urlArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted", + getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), channelReply -> callback.reply(null)); } - public void onPageFinished(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Reply callback) { + + public void onPageFinished( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull String urlArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished", + getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), channelReply -> callback.reply(null)); } - public void onReceivedRequestError(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull WebResourceRequestData requestArg, @NonNull WebResourceErrorData errorArg, @NonNull Reply callback) { + + public void onReceivedRequestError( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull WebResourceRequestData requestArg, + @NonNull WebResourceErrorData errorArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError", + getCodec()); channel.send( - new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg, errorArg)), + new ArrayList( + Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg, errorArg)), channelReply -> callback.reply(null)); } - public void onReceivedError(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull Long errorCodeArg, @NonNull String descriptionArg, @NonNull String failingUrlArg, @NonNull Reply callback) { + + public void onReceivedError( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull Long errorCodeArg, + @NonNull String descriptionArg, + @NonNull String failingUrlArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError", + getCodec()); channel.send( - new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, errorCodeArg, descriptionArg, failingUrlArg)), + new ArrayList( + Arrays.asList( + instanceIdArg, + webViewInstanceIdArg, + errorCodeArg, + descriptionArg, + failingUrlArg)), channelReply -> callback.reply(null)); } - public void requestLoading(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull WebResourceRequestData requestArg, @NonNull Reply callback) { + + public void requestLoading( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull WebResourceRequestData requestArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading", + getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, requestArg)), channelReply -> callback.reply(null)); } - public void urlLoading(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Reply callback) { + + public void urlLoading( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull String urlArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading", getCodec()); @@ -2113,12 +2283,21 @@ public void urlLoading(@NonNull Long instanceIdArg, @NonNull Long webViewInstanc new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)), channelReply -> callback.reply(null)); } - public void doUpdateVisitedHistory(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull String urlArg, @NonNull Boolean isReloadArg, @NonNull Reply callback) { + + public void doUpdateVisitedHistory( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull String urlArg, + @NonNull Boolean isReloadArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory", + getCodec()); channel.send( - new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg, isReloadArg)), + new ArrayList( + Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg, isReloadArg)), channelReply -> callback.reply(null)); } } @@ -2131,8 +2310,12 @@ public interface DownloadListenerHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `DownloadListenerHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DownloadListenerHostApi api) { + /** + * Sets up an instance of `DownloadListenerHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable DownloadListenerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2146,8 +2329,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable DownloadLi try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2167,7 +2349,7 @@ public DownloadListenerFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2176,12 +2358,29 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void onDownloadStart(@NonNull Long instanceIdArg, @NonNull String urlArg, @NonNull String userAgentArg, @NonNull String contentDispositionArg, @NonNull String mimetypeArg, @NonNull Long contentLengthArg, @NonNull Reply callback) { + + public void onDownloadStart( + @NonNull Long instanceIdArg, + @NonNull String urlArg, + @NonNull String userAgentArg, + @NonNull String contentDispositionArg, + @NonNull String mimetypeArg, + @NonNull Long contentLengthArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart", + getCodec()); channel.send( - new ArrayList(Arrays.asList(instanceIdArg, urlArg, userAgentArg, contentDispositionArg, mimetypeArg, contentLengthArg)), + new ArrayList( + Arrays.asList( + instanceIdArg, + urlArg, + userAgentArg, + contentDispositionArg, + mimetypeArg, + contentLengthArg)), channelReply -> callback.reply(null)); } } @@ -2190,14 +2389,19 @@ public interface WebChromeClientHostApi { void create(@NonNull Long instanceId); - void setSynchronousReturnValueForOnShowFileChooser(@NonNull Long instanceId, @NonNull Boolean value); + void setSynchronousReturnValueForOnShowFileChooser( + @NonNull Long instanceId, @NonNull Boolean value); /** The codec used by WebChromeClientHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `WebChromeClientHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeClientHostApi api) { + /** + * Sets up an instance of `WebChromeClientHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeClientHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2211,8 +2415,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeC try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2225,7 +2428,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeC { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2234,10 +2439,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeC Number instanceIdArg = (Number) args.get(0); Boolean valueArg = (Boolean) args.get(1); try { - api.setSynchronousReturnValueForOnShowFileChooser((instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); + api.setSynchronousReturnValueForOnShowFileChooser( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2252,18 +2457,22 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeC /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface FlutterAssetManagerHostApi { - @NonNull + @NonNull List list(@NonNull String path); - @NonNull + @NonNull String getAssetFilePathByName(@NonNull String name); /** The codec used by FlutterAssetManagerHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `FlutterAssetManagerHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable FlutterAssetManagerHostApi api) { + /** + * Sets up an instance of `FlutterAssetManagerHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable FlutterAssetManagerHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2277,8 +2486,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable FlutterAss try { List output = api.list(pathArg); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2291,7 +2499,9 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable FlutterAss { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2301,8 +2511,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable FlutterAss try { String output = api.getAssetFilePathByName(nameArg); wrapped.add(0, output); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2322,7 +2531,7 @@ public WebChromeClientFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2331,20 +2540,35 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - public void onProgressChanged(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull Long progressArg, @NonNull Reply callback) { + + public void onProgressChanged( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull Long progressArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged", + getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, progressArg)), channelReply -> callback.reply(null)); } - public void onShowFileChooser(@NonNull Long instanceIdArg, @NonNull Long webViewInstanceIdArg, @NonNull Long paramsInstanceIdArg, @NonNull Reply> callback) { + + public void onShowFileChooser( + @NonNull Long instanceIdArg, + @NonNull Long webViewInstanceIdArg, + @NonNull Long paramsInstanceIdArg, + @NonNull Reply> callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser", + getCodec()); channel.send( - new ArrayList(Arrays.asList(instanceIdArg, webViewInstanceIdArg, paramsInstanceIdArg)), + new ArrayList( + Arrays.asList(instanceIdArg, webViewInstanceIdArg, paramsInstanceIdArg)), channelReply -> { @SuppressWarnings("ConstantConditions") List output = (List) channelReply; @@ -2352,46 +2576,69 @@ public void onShowFileChooser(@NonNull Long instanceIdArg, @NonNull Long webView }); } /** Callback to Dart function `WebChromeClient.onPermissionRequest`. */ - public void onPermissionRequest(@NonNull Long instanceIdArg, @NonNull Long requestInstanceIdArg, @NonNull Reply callback) { + public void onPermissionRequest( + @NonNull Long instanceIdArg, + @NonNull Long requestInstanceIdArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest", + getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, requestInstanceIdArg)), channelReply -> callback.reply(null)); } /** Callback to Dart function `WebChromeClient.onShowCustomView`. */ - public void onShowCustomView(@NonNull Long instanceIdArg, @NonNull Long viewIdentifierArg, @NonNull Long callbackIdentifierArg, @NonNull Reply callback) { + public void onShowCustomView( + @NonNull Long instanceIdArg, + @NonNull Long viewIdentifierArg, + @NonNull Long callbackIdentifierArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView", + getCodec()); channel.send( - new ArrayList(Arrays.asList(instanceIdArg, viewIdentifierArg, callbackIdentifierArg)), + new ArrayList( + Arrays.asList(instanceIdArg, viewIdentifierArg, callbackIdentifierArg)), channelReply -> callback.reply(null)); } /** Callback to Dart function `WebChromeClient.onHideCustomView`. */ public void onHideCustomView(@NonNull Long instanceIdArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onHideCustomView", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebChromeClientFlutterApi.onHideCustomView", + getCodec()); channel.send( new ArrayList(Collections.singletonList(instanceIdArg)), channelReply -> callback.reply(null)); } /** Callback to Dart function `WebChromeClient.onGeolocationPermissionsShowPrompt`. */ - public void onGeolocationPermissionsShowPrompt(@NonNull Long instanceIdArg, @NonNull Long paramsInstanceIdArg, @NonNull String originArg, @NonNull Reply callback) { + public void onGeolocationPermissionsShowPrompt( + @NonNull Long instanceIdArg, + @NonNull Long paramsInstanceIdArg, + @NonNull String originArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsShowPrompt", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsShowPrompt", + getCodec()); channel.send( new ArrayList(Arrays.asList(instanceIdArg, paramsInstanceIdArg, originArg)), channelReply -> callback.reply(null)); } /** Callback to Dart function `WebChromeClient.onGeolocationPermissionsHidePrompt`. */ - public void onGeolocationPermissionsHidePrompt(@NonNull Long identifierArg, @NonNull Reply callback) { + public void onGeolocationPermissionsHidePrompt( + @NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsHidePrompt", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsHidePrompt", + getCodec()); channel.send( new ArrayList(Collections.singletonList(identifierArg)), channelReply -> callback.reply(null)); @@ -2408,7 +2655,9 @@ public interface WebStorageHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `WebStorageHostApi` to handle messages through the `binaryMessenger`. */ + /** + * Sets up an instance of `WebStorageHostApi` to handle messages through the `binaryMessenger`. + */ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorageHostApi api) { { BasicMessageChannel channel = @@ -2423,8 +2672,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorage try { api.create((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2447,8 +2695,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorage try { api.deleteAllData((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2462,7 +2709,8 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorage } private static class FileChooserParamsFlutterApiCodec extends StandardMessageCodec { - public static final FileChooserParamsFlutterApiCodec INSTANCE = new FileChooserParamsFlutterApiCodec(); + public static final FileChooserParamsFlutterApiCodec INSTANCE = + new FileChooserParamsFlutterApiCodec(); private FileChooserParamsFlutterApiCodec() {} @@ -2490,9 +2738,10 @@ protected void writeValue(@NonNull ByteArrayOutputStream stream, Object value) { /** * Handles callbacks methods for the native Java FileChooserParams class. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. * - * Generated class from Pigeon that represents Flutter messages that can be called from Java. + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class FileChooserParamsFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2501,7 +2750,7 @@ public FileChooserParamsFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2510,25 +2759,34 @@ public interface Reply { static @NonNull MessageCodec getCodec() { return FileChooserParamsFlutterApiCodec.INSTANCE; } - public void create(@NonNull Long instanceIdArg, @NonNull Boolean isCaptureEnabledArg, @NonNull List acceptTypesArg, @NonNull FileChooserModeEnumData modeArg, @Nullable String filenameHintArg, @NonNull Reply callback) { + + public void create( + @NonNull Long instanceIdArg, + @NonNull Boolean isCaptureEnabledArg, + @NonNull List acceptTypesArg, + @NonNull FileChooserModeEnumData modeArg, + @Nullable String filenameHintArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.FileChooserParamsFlutterApi.create", getCodec()); channel.send( - new ArrayList(Arrays.asList(instanceIdArg, isCaptureEnabledArg, acceptTypesArg, modeArg, filenameHintArg)), + new ArrayList( + Arrays.asList( + instanceIdArg, isCaptureEnabledArg, acceptTypesArg, modeArg, filenameHintArg)), channelReply -> callback.reply(null)); } } /** * Host API for `PermissionRequest`. * - * This class may handle instantiating and adding native object instances that - * are attached to a Dart instance or handle method calls on the associated - * native class or an instance of the class. + *

This class may handle instantiating and adding native object instances that are attached to + * a Dart instance or handle method calls on the associated native class or an instance of the + * class. * - * See https://developer.android.com/reference/android/webkit/PermissionRequest. + *

See https://developer.android.com/reference/android/webkit/PermissionRequest. * - * Generated interface from Pigeon that represents a handler of messages from Flutter. + *

Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface PermissionRequestHostApi { /** Handles Dart method `PermissionRequest.grant`. */ @@ -2540,8 +2798,12 @@ public interface PermissionRequestHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `PermissionRequestHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable PermissionRequestHostApi api) { + /** + * Sets up an instance of `PermissionRequestHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable PermissionRequestHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( @@ -2554,10 +2816,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable Permission Number instanceIdArg = (Number) args.get(0); List resourcesArg = (List) args.get(1); try { - api.grant((instanceIdArg == null) ? null : instanceIdArg.longValue(), resourcesArg); + api.grant( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), resourcesArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2580,8 +2842,7 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable Permission try { api.deny((instanceIdArg == null) ? null : instanceIdArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2596,13 +2857,12 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable Permission /** * Flutter API for `PermissionRequest`. * - * This class may handle instantiating and adding Dart instances that are - * attached to a native instance or receiving callback methods from an - * overridden native class. + *

This class may handle instantiating and adding Dart instances that are attached to a native + * instance or receiving callback methods from an overridden native class. * - * See https://developer.android.com/reference/android/webkit/PermissionRequest. + *

See https://developer.android.com/reference/android/webkit/PermissionRequest. * - * Generated class from Pigeon that represents Flutter messages that can be called from Java. + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class PermissionRequestFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2611,7 +2871,7 @@ public PermissionRequestFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2621,7 +2881,10 @@ public interface Reply { return new StandardMessageCodec(); } /** Create a new Dart instance and add it to the `InstanceManager`. */ - public void create(@NonNull Long instanceIdArg, @NonNull List resourcesArg, @NonNull Reply callback) { + public void create( + @NonNull Long instanceIdArg, + @NonNull List resourcesArg, + @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( binaryMessenger, "dev.flutter.pigeon.PermissionRequestFlutterApi.create", getCodec()); @@ -2633,13 +2896,14 @@ public void create(@NonNull Long instanceIdArg, @NonNull List resourcesA /** * Host API for `CustomViewCallback`. * - * This class may handle instantiating and adding native object instances that - * are attached to a Dart instance or handle method calls on the associated - * native class or an instance of the class. + *

This class may handle instantiating and adding native object instances that are attached to + * a Dart instance or handle method calls on the associated native class or an instance of the + * class. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. * - * Generated interface from Pigeon that represents a handler of messages from Flutter. + *

Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface CustomViewCallbackHostApi { /** Handles Dart method `CustomViewCallback.onCustomViewHidden`. */ @@ -2649,12 +2913,18 @@ public interface CustomViewCallbackHostApi { static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `CustomViewCallbackHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CustomViewCallbackHostApi api) { + /** + * Sets up an instance of `CustomViewCallbackHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, @Nullable CustomViewCallbackHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2662,10 +2932,10 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CustomView ArrayList args = (ArrayList) message; Number identifierArg = (Number) args.get(0); try { - api.onCustomViewHidden((identifierArg == null) ? null : identifierArg.longValue()); + api.onCustomViewHidden( + (identifierArg == null) ? null : identifierArg.longValue()); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2680,13 +2950,13 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable CustomView /** * Flutter API for `CustomViewCallback`. * - * This class may handle instantiating and adding Dart instances that are - * attached to a native instance or receiving callback methods from an - * overridden native class. + *

This class may handle instantiating and adding Dart instances that are attached to a native + * instance or receiving callback methods from an overridden native class. * - * See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. + *

See + * https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. * - * Generated class from Pigeon that represents Flutter messages that can be called from Java. + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class CustomViewCallbackFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2695,7 +2965,7 @@ public CustomViewCallbackFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2708,7 +2978,9 @@ public interface Reply { public void create(@NonNull Long identifierArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.CustomViewCallbackFlutterApi.create", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.CustomViewCallbackFlutterApi.create", + getCodec()); channel.send( new ArrayList(Collections.singletonList(identifierArg)), channelReply -> callback.reply(null)); @@ -2717,13 +2989,12 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { /** * Flutter API for `View`. * - * This class may handle instantiating and adding Dart instances that are - * attached to a native instance or receiving callback methods from an - * overridden native class. + *

This class may handle instantiating and adding Dart instances that are attached to a native + * instance or receiving callback methods from an overridden native class. * - * See https://developer.android.com/reference/android/view/View. + *

See https://developer.android.com/reference/android/view/View. * - * Generated class from Pigeon that represents Flutter messages that can be called from Java. + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class ViewFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2732,7 +3003,7 @@ public ViewFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) { this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2754,28 +3025,39 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { /** * Host API for `GeolocationPermissionsCallback`. * - * This class may handle instantiating and adding native object instances that - * are attached to a Dart instance or handle method calls on the associated - * native class or an instance of the class. + *

This class may handle instantiating and adding native object instances that are attached to + * a Dart instance or handle method calls on the associated native class or an instance of the + * class. * - * See https://developer.android.com/reference/android/webkit/GeolocationPermissions.Callback. + *

See https://developer.android.com/reference/android/webkit/GeolocationPermissions.Callback. * - * Generated interface from Pigeon that represents a handler of messages from Flutter. + *

Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface GeolocationPermissionsCallbackHostApi { /** Handles Dart method `GeolocationPermissionsCallback.invoke`. */ - void invoke(@NonNull Long instanceId, @NonNull String origin, @NonNull Boolean allow, @NonNull Boolean retain); + void invoke( + @NonNull Long instanceId, + @NonNull String origin, + @NonNull Boolean allow, + @NonNull Boolean retain); /** The codec used by GeolocationPermissionsCallbackHostApi. */ static @NonNull MessageCodec getCodec() { return new StandardMessageCodec(); } - /**Sets up an instance of `GeolocationPermissionsCallbackHostApi` to handle messages through the `binaryMessenger`. */ - static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable GeolocationPermissionsCallbackHostApi api) { + /** + * Sets up an instance of `GeolocationPermissionsCallbackHostApi` to handle messages through the + * `binaryMessenger`. + */ + static void setup( + @NonNull BinaryMessenger binaryMessenger, + @Nullable GeolocationPermissionsCallbackHostApi api) { { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.GeolocationPermissionsCallbackHostApi.invoke", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.GeolocationPermissionsCallbackHostApi.invoke", + getCodec()); if (api != null) { channel.setMessageHandler( (message, reply) -> { @@ -2786,10 +3068,13 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable Geolocatio Boolean allowArg = (Boolean) args.get(2); Boolean retainArg = (Boolean) args.get(3); try { - api.invoke((instanceIdArg == null) ? null : instanceIdArg.longValue(), originArg, allowArg, retainArg); + api.invoke( + (instanceIdArg == null) ? null : instanceIdArg.longValue(), + originArg, + allowArg, + retainArg); wrapped.add(0, null); - } - catch (Throwable exception) { + } catch (Throwable exception) { ArrayList wrappedError = wrapError(exception); wrapped = wrappedError; } @@ -2804,13 +3089,12 @@ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable Geolocatio /** * Flutter API for `GeolocationPermissionsCallback`. * - * This class may handle instantiating and adding Dart instances that are - * attached to a native instance or receiving callback methods from an - * overridden native class. + *

This class may handle instantiating and adding Dart instances that are attached to a native + * instance or receiving callback methods from an overridden native class. * - * See https://developer.android.com/reference/android/webkit/GeolocationPermissions.Callback. + *

See https://developer.android.com/reference/android/webkit/GeolocationPermissions.Callback. * - * Generated class from Pigeon that represents Flutter messages that can be called from Java. + *

Generated class from Pigeon that represents Flutter messages that can be called from Java. */ public static class GeolocationPermissionsCallbackFlutterApi { private final @NonNull BinaryMessenger binaryMessenger; @@ -2819,7 +3103,7 @@ public GeolocationPermissionsCallbackFlutterApi(@NonNull BinaryMessenger argBina this.binaryMessenger = argBinaryMessenger; } - /** Public interface for sending reply. */ + /** Public interface for sending reply. */ @SuppressWarnings("UnknownNullness") public interface Reply { void reply(T reply); @@ -2832,7 +3116,9 @@ public interface Reply { public void create(@NonNull Long instanceIdArg, @NonNull Reply callback) { BasicMessageChannel channel = new BasicMessageChannel<>( - binaryMessenger, "dev.flutter.pigeon.GeolocationPermissionsCallbackFlutterApi.create", getCodec()); + binaryMessenger, + "dev.flutter.pigeon.GeolocationPermissionsCallbackFlutterApi.create", + getCodec()); channel.send( new ArrayList(Collections.singletonList(instanceIdArg)), channelReply -> callback.reply(null)); diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java index 7f52924e75c0..4e09b2e4b452 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebChromeClientTest.java @@ -15,11 +15,8 @@ import android.net.Uri; import android.os.Message; -<<<<<<< HEAD import android.view.View; -======= import android.webkit.GeolocationPermissions; ->>>>>>> origin/main import android.webkit.PermissionRequest; import android.webkit.WebChromeClient; import android.webkit.WebResourceRequest; diff --git a/packages/webview_flutter/webview_flutter_android/example/lib/main.dart b/packages/webview_flutter/webview_flutter_android/example/lib/main.dart index a80d4d2f973e..c8d0fb975070 100644 --- a/packages/webview_flutter/webview_flutter_android/example/lib/main.dart +++ b/packages/webview_flutter/webview_flutter_android/example/lib/main.dart @@ -33,19 +33,6 @@ The navigation delegate is set to block navigation to the youtube website. '''; -const String kVideoExamplePage = ''' - -Video example - - - - -'''; - const String kLocalExamplePage = ''' @@ -130,7 +117,7 @@ Page resource error: '''); }) ..setOnNavigationRequest((NavigationRequest request) { - if (request.url.startsWith('https://www.youtube.com/')) { + if (request.url.contains('pub.dev')) { debugPrint('blocking navigation to ${request.url}'); return NavigationDecision.prevent; } @@ -435,18 +422,23 @@ class SampleMenu extends StatelessWidget { Future _onVideoExample(BuildContext context) { final AndroidWebViewController androidController = webViewController as AndroidWebViewController; - androidController.setCustomViewCallbacks( - onShowCustomView: - (AndroidCustomViewWidget widget, OnHideCustomViewCallback callback) { + androidController.setCustomWidgetCallbacks( + onShowCustomWidget: (Widget widget, OnHideCustomWidgetCallback callback) { Navigator.of(context).push(MaterialPageRoute( builder: (BuildContext context) => widget, fullscreenDialog: true, )); }, - onHideCustomView: () {}, + onHideCustomWidget: () { + Navigator.of(context).pop(); + }, ); - return androidController.loadHtmlString(kVideoExamplePage); + return androidController.loadRequest( + LoadRequestParams( + uri: Uri.parse('https://www.youtube.com/watch?v=4AoFA19gbLo'), + ), + ); } Future _onDoPostRequest() { diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart index 2a83332f479f..eef36f7f1c45 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart @@ -20,10 +20,12 @@ enum FileChooserMode { /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN. open, + /// Similar to [open] but allows multiple files to be selected. /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_OPEN_MULTIPLE. openMultiple, + /// Allows picking a nonexistent file and saving it. /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams#MODE_SAVE. @@ -92,7 +94,8 @@ class WebResourceRequestData { isRedirect: result[2] as bool?, hasGesture: result[3]! as bool, method: result[4]! as String, - requestHeaders: (result[5] as Map?)!.cast(), + requestHeaders: + (result[5] as Map?)!.cast(), ); } } @@ -167,8 +170,7 @@ class InstanceManagerHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.InstanceManagerHostApi.clear', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send(null) as List?; + final List? replyList = await channel.send(null) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -232,7 +234,8 @@ abstract class JavaObjectFlutterApi { void dispose(int identifier); - static void setup(JavaObjectFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(JavaObjectFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaObjectFlutterApi.dispose', codec, @@ -242,7 +245,7 @@ abstract class JavaObjectFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.JavaObjectFlutterApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -294,12 +297,13 @@ class CookieManagerHostApi { } /// Handles Dart method `CookieManager.setCookie`. - Future setCookie(int arg_identifier, String arg_url, String arg_value) async { + Future setCookie( + int arg_identifier, String arg_url, String arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CookieManagerHostApi.setCookie', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_url, arg_value]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_url, arg_value]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -345,12 +349,15 @@ class CookieManagerHostApi { } /// Handles Dart method `CookieManager.setAcceptThirdPartyCookies`. - Future setAcceptThirdPartyCookies(int arg_identifier, int arg_webViewIdentifier, bool arg_accept) async { + Future setAcceptThirdPartyCookies( + int arg_identifier, int arg_webViewIdentifier, bool arg_accept) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies', codec, + 'dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_identifier, arg_webViewIdentifier, arg_accept]) as List?; + final List? replyList = await channel + .send([arg_identifier, arg_webViewIdentifier, arg_accept]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -383,7 +390,7 @@ class _WebViewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebViewPoint.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -423,12 +430,14 @@ class WebViewHostApi { } } - Future loadData(int arg_instanceId, String arg_data, String? arg_mimeType, String? arg_encoding) async { + Future loadData(int arg_instanceId, String arg_data, + String? arg_mimeType, String? arg_encoding) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.loadData', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_data, arg_mimeType, arg_encoding]) as List?; + final List? replyList = await channel.send( + [arg_instanceId, arg_data, arg_mimeType, arg_encoding]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -445,12 +454,24 @@ class WebViewHostApi { } } - Future loadDataWithBaseUrl(int arg_instanceId, String? arg_baseUrl, String arg_data, String? arg_mimeType, String? arg_encoding, String? arg_historyUrl) async { + Future loadDataWithBaseUrl( + int arg_instanceId, + String? arg_baseUrl, + String arg_data, + String? arg_mimeType, + String? arg_encoding, + String? arg_historyUrl) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_baseUrl, arg_data, arg_mimeType, arg_encoding, arg_historyUrl]) as List?; + final List? replyList = await channel.send([ + arg_instanceId, + arg_baseUrl, + arg_data, + arg_mimeType, + arg_encoding, + arg_historyUrl + ]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -467,12 +488,14 @@ class WebViewHostApi { } } - Future loadUrl(int arg_instanceId, String arg_url, Map arg_headers) async { + Future loadUrl(int arg_instanceId, String arg_url, + Map arg_headers) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.loadUrl', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_url, arg_headers]) as List?; + await channel.send([arg_instanceId, arg_url, arg_headers]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -489,12 +512,13 @@ class WebViewHostApi { } } - Future postUrl(int arg_instanceId, String arg_url, Uint8List arg_data) async { + Future postUrl( + int arg_instanceId, String arg_url, Uint8List arg_data) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.postUrl', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_url, arg_data]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_url, arg_data]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -658,7 +682,8 @@ class WebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.clearCache', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_includeDiskFiles]) as List?; + await channel.send([arg_instanceId, arg_includeDiskFiles]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -675,12 +700,14 @@ class WebViewHostApi { } } - Future evaluateJavascript(int arg_instanceId, String arg_javascriptString) async { + Future evaluateJavascript( + int arg_instanceId, String arg_javascriptString) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.evaluateJavascript', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_javascriptString]) as List?; + await channel.send([arg_instanceId, arg_javascriptString]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -723,8 +750,8 @@ class WebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.scrollTo', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_x, arg_y]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_x, arg_y]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -745,8 +772,8 @@ class WebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.scrollBy', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_x, arg_y]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_x, arg_y]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -846,7 +873,8 @@ class WebViewHostApi { Future setWebContentsDebuggingEnabled(bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', codec, + 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_enabled]) as List?; @@ -866,12 +894,14 @@ class WebViewHostApi { } } - Future setWebViewClient(int arg_instanceId, int arg_webViewClientInstanceId) async { + Future setWebViewClient( + int arg_instanceId, int arg_webViewClientInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setWebViewClient', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_webViewClientInstanceId]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_webViewClientInstanceId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -888,12 +918,14 @@ class WebViewHostApi { } } - Future addJavaScriptChannel(int arg_instanceId, int arg_javaScriptChannelInstanceId) async { + Future addJavaScriptChannel( + int arg_instanceId, int arg_javaScriptChannelInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_javaScriptChannelInstanceId]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_javaScriptChannelInstanceId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -910,12 +942,14 @@ class WebViewHostApi { } } - Future removeJavaScriptChannel(int arg_instanceId, int arg_javaScriptChannelInstanceId) async { + Future removeJavaScriptChannel( + int arg_instanceId, int arg_javaScriptChannelInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_javaScriptChannelInstanceId]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_javaScriptChannelInstanceId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -932,12 +966,14 @@ class WebViewHostApi { } } - Future setDownloadListener(int arg_instanceId, int? arg_listenerInstanceId) async { + Future setDownloadListener( + int arg_instanceId, int? arg_listenerInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setDownloadListener', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_listenerInstanceId]) as List?; + await channel.send([arg_instanceId, arg_listenerInstanceId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -954,12 +990,14 @@ class WebViewHostApi { } } - Future setWebChromeClient(int arg_instanceId, int? arg_clientInstanceId) async { + Future setWebChromeClient( + int arg_instanceId, int? arg_clientInstanceId) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setWebChromeClient', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_clientInstanceId]) as List?; + await channel.send([arg_instanceId, arg_clientInstanceId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -980,8 +1018,8 @@ class WebViewHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.setBackgroundColor', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_color]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_color]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1012,7 +1050,8 @@ abstract class WebViewFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int identifier); - static void setup(WebViewFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(WebViewFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewFlutterApi.create', codec, @@ -1022,7 +1061,7 @@ abstract class WebViewFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebViewFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1050,7 +1089,8 @@ class WebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.create', codec, binaryMessenger: _binaryMessenger); final List? replyList = - await channel.send([arg_instanceId, arg_webViewInstanceId]) as List?; + await channel.send([arg_instanceId, arg_webViewInstanceId]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1071,8 +1111,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_flag]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_flag]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1089,12 +1129,14 @@ class WebSettingsHostApi { } } - Future setJavaScriptCanOpenWindowsAutomatically(int arg_instanceId, bool arg_flag) async { + Future setJavaScriptCanOpenWindowsAutomatically( + int arg_instanceId, bool arg_flag) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_flag]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_flag]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1111,12 +1153,14 @@ class WebSettingsHostApi { } } - Future setSupportMultipleWindows(int arg_instanceId, bool arg_support) async { + Future setSupportMultipleWindows( + int arg_instanceId, bool arg_support) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_support]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_support]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1137,8 +1181,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_flag]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_flag]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1155,12 +1199,13 @@ class WebSettingsHostApi { } } - Future setUserAgentString(int arg_instanceId, String? arg_userAgentString) async { + Future setUserAgentString( + int arg_instanceId, String? arg_userAgentString) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_userAgentString]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_userAgentString]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1177,12 +1222,14 @@ class WebSettingsHostApi { } } - Future setMediaPlaybackRequiresUserGesture(int arg_instanceId, bool arg_require) async { + Future setMediaPlaybackRequiresUserGesture( + int arg_instanceId, bool arg_require) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_require]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_require]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1203,8 +1250,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_support]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_support]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1221,12 +1268,13 @@ class WebSettingsHostApi { } } - Future setLoadWithOverviewMode(int arg_instanceId, bool arg_overview) async { + Future setLoadWithOverviewMode( + int arg_instanceId, bool arg_overview) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_overview]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_overview]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1247,8 +1295,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_use]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_use]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1265,12 +1313,13 @@ class WebSettingsHostApi { } } - Future setDisplayZoomControls(int arg_instanceId, bool arg_enabled) async { + Future setDisplayZoomControls( + int arg_instanceId, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_enabled]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1287,12 +1336,13 @@ class WebSettingsHostApi { } } - Future setBuiltInZoomControls(int arg_instanceId, bool arg_enabled) async { + Future setBuiltInZoomControls( + int arg_instanceId, bool arg_enabled) async { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_enabled]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1313,8 +1363,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_enabled]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_enabled]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1335,8 +1385,8 @@ class WebSettingsHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.setTextZoom', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_textZoom]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_textZoom]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1368,8 +1418,8 @@ class JavaScriptChannelHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelHostApi.create', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_channelName]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_channelName]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1392,7 +1442,8 @@ abstract class JavaScriptChannelFlutterApi { void postMessage(int instanceId, String message); - static void setup(JavaScriptChannelFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(JavaScriptChannelFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage', codec, @@ -1402,7 +1453,7 @@ abstract class JavaScriptChannelFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage was null.'); + 'Argument for dev.flutter.pigeon.JavaScriptChannelFlutterApi.postMessage was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1450,12 +1501,14 @@ class WebViewClientHostApi { } } - Future setSynchronousReturnValueForShouldOverrideUrlLoading(int arg_instanceId, bool arg_value) async { + Future setSynchronousReturnValueForShouldOverrideUrlLoading( + int arg_instanceId, bool arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', codec, + 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_value]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_value]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1491,9 +1544,9 @@ class _WebViewClientFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebResourceErrorData.decode(readValue(buffer)!); - case 129: + case 129: return WebResourceRequestData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -1508,17 +1561,22 @@ abstract class WebViewClientFlutterApi { void onPageFinished(int instanceId, int webViewInstanceId, String url); - void onReceivedRequestError(int instanceId, int webViewInstanceId, WebResourceRequestData request, WebResourceErrorData error); + void onReceivedRequestError(int instanceId, int webViewInstanceId, + WebResourceRequestData request, WebResourceErrorData error); - void onReceivedError(int instanceId, int webViewInstanceId, int errorCode, String description, String failingUrl); + void onReceivedError(int instanceId, int webViewInstanceId, int errorCode, + String description, String failingUrl); - void requestLoading(int instanceId, int webViewInstanceId, WebResourceRequestData request); + void requestLoading( + int instanceId, int webViewInstanceId, WebResourceRequestData request); void urlLoading(int instanceId, int webViewInstanceId, String url); - void doUpdateVisitedHistory(int instanceId, int webViewInstanceId, String url, bool isReload); + void doUpdateVisitedHistory( + int instanceId, int webViewInstanceId, String url, bool isReload); - static void setup(WebViewClientFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(WebViewClientFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted', codec, @@ -1528,7 +1586,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageStarted was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1553,7 +1611,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onPageFinished was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1571,14 +1629,15 @@ abstract class WebViewClientFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError', codec, + 'dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1586,13 +1645,16 @@ abstract class WebViewClientFlutterApi { final int? arg_webViewInstanceId = (args[1] as int?); assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null int.'); - final WebResourceRequestData? arg_request = (args[2] as WebResourceRequestData?); + final WebResourceRequestData? arg_request = + (args[2] as WebResourceRequestData?); assert(arg_request != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null WebResourceRequestData.'); - final WebResourceErrorData? arg_error = (args[3] as WebResourceErrorData?); + final WebResourceErrorData? arg_error = + (args[3] as WebResourceErrorData?); assert(arg_error != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedRequestError was null, expected non-null WebResourceErrorData.'); - api.onReceivedRequestError(arg_instanceId!, arg_webViewInstanceId!, arg_request!, arg_error!); + api.onReceivedRequestError(arg_instanceId!, arg_webViewInstanceId!, + arg_request!, arg_error!); return; }); } @@ -1606,7 +1668,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1623,7 +1685,8 @@ abstract class WebViewClientFlutterApi { final String? arg_failingUrl = (args[4] as String?); assert(arg_failingUrl != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.onReceivedError was null, expected non-null String.'); - api.onReceivedError(arg_instanceId!, arg_webViewInstanceId!, arg_errorCode!, arg_description!, arg_failingUrl!); + api.onReceivedError(arg_instanceId!, arg_webViewInstanceId!, + arg_errorCode!, arg_description!, arg_failingUrl!); return; }); } @@ -1637,7 +1700,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1645,10 +1708,12 @@ abstract class WebViewClientFlutterApi { final int? arg_webViewInstanceId = (args[1] as int?); assert(arg_webViewInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null, expected non-null int.'); - final WebResourceRequestData? arg_request = (args[2] as WebResourceRequestData?); + final WebResourceRequestData? arg_request = + (args[2] as WebResourceRequestData?); assert(arg_request != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.requestLoading was null, expected non-null WebResourceRequestData.'); - api.requestLoading(arg_instanceId!, arg_webViewInstanceId!, arg_request!); + api.requestLoading( + arg_instanceId!, arg_webViewInstanceId!, arg_request!); return; }); } @@ -1662,7 +1727,7 @@ abstract class WebViewClientFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1680,14 +1745,15 @@ abstract class WebViewClientFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory', codec, + 'dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1701,7 +1767,8 @@ abstract class WebViewClientFlutterApi { final bool? arg_isReload = (args[3] as bool?); assert(arg_isReload != null, 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null, expected non-null bool.'); - api.doUpdateVisitedHistory(arg_instanceId!, arg_webViewInstanceId!, arg_url!, arg_isReload!); + api.doUpdateVisitedHistory( + arg_instanceId!, arg_webViewInstanceId!, arg_url!, arg_isReload!); return; }); } @@ -1745,19 +1812,22 @@ class DownloadListenerHostApi { abstract class DownloadListenerFlutterApi { static const MessageCodec codec = StandardMessageCodec(); - void onDownloadStart(int instanceId, String url, String userAgent, String contentDisposition, String mimetype, int contentLength); + void onDownloadStart(int instanceId, String url, String userAgent, + String contentDisposition, String mimetype, int contentLength); - static void setup(DownloadListenerFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(DownloadListenerFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart', codec, + 'dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null.'); + 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1777,7 +1847,8 @@ abstract class DownloadListenerFlutterApi { final int? arg_contentLength = (args[5] as int?); assert(arg_contentLength != null, 'Argument for dev.flutter.pigeon.DownloadListenerFlutterApi.onDownloadStart was null, expected non-null int.'); - api.onDownloadStart(arg_instanceId!, arg_url!, arg_userAgent!, arg_contentDisposition!, arg_mimetype!, arg_contentLength!); + api.onDownloadStart(arg_instanceId!, arg_url!, arg_userAgent!, + arg_contentDisposition!, arg_mimetype!, arg_contentLength!); return; }); } @@ -1817,12 +1888,14 @@ class WebChromeClientHostApi { } } - Future setSynchronousReturnValueForOnShowFileChooser(int arg_instanceId, bool arg_value) async { + Future setSynchronousReturnValueForOnShowFileChooser( + int arg_instanceId, bool arg_value) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', codec, + 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_value]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_value]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -1879,7 +1952,8 @@ class FlutterAssetManagerHostApi { Future getAssetFilePathByName(String arg_name) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', codec, + 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_name]) as List?; @@ -1910,34 +1984,39 @@ abstract class WebChromeClientFlutterApi { void onProgressChanged(int instanceId, int webViewInstanceId, int progress); - Future> onShowFileChooser(int instanceId, int webViewInstanceId, int paramsInstanceId); + Future> onShowFileChooser( + int instanceId, int webViewInstanceId, int paramsInstanceId); /// Callback to Dart function `WebChromeClient.onPermissionRequest`. void onPermissionRequest(int instanceId, int requestInstanceId); /// Callback to Dart function `WebChromeClient.onShowCustomView`. - void onShowCustomView(int instanceId, int viewIdentifier, int callbackIdentifier); + void onShowCustomView( + int instanceId, int viewIdentifier, int callbackIdentifier); /// Callback to Dart function `WebChromeClient.onHideCustomView`. void onHideCustomView(int instanceId); /// Callback to Dart function `WebChromeClient.onGeolocationPermissionsShowPrompt`. - void onGeolocationPermissionsShowPrompt(int instanceId, int paramsInstanceId, String origin); + void onGeolocationPermissionsShowPrompt( + int instanceId, int paramsInstanceId, String origin); /// Callback to Dart function `WebChromeClient.onGeolocationPermissionsHidePrompt`. void onGeolocationPermissionsHidePrompt(int identifier); - static void setup(WebChromeClientFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(WebChromeClientFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged', codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1948,21 +2027,23 @@ abstract class WebChromeClientFlutterApi { final int? arg_progress = (args[2] as int?); assert(arg_progress != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onProgressChanged was null, expected non-null int.'); - api.onProgressChanged(arg_instanceId!, arg_webViewInstanceId!, arg_progress!); + api.onProgressChanged( + arg_instanceId!, arg_webViewInstanceId!, arg_progress!); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser', codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1973,21 +2054,23 @@ abstract class WebChromeClientFlutterApi { final int? arg_paramsInstanceId = (args[2] as int?); assert(arg_paramsInstanceId != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowFileChooser was null, expected non-null int.'); - final List output = await api.onShowFileChooser(arg_instanceId!, arg_webViewInstanceId!, arg_paramsInstanceId!); + final List output = await api.onShowFileChooser( + arg_instanceId!, arg_webViewInstanceId!, arg_paramsInstanceId!); return output; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest', codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onPermissionRequest was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -2002,14 +2085,15 @@ abstract class WebChromeClientFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView', codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -2020,21 +2104,23 @@ abstract class WebChromeClientFlutterApi { final int? arg_callbackIdentifier = (args[2] as int?); assert(arg_callbackIdentifier != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onShowCustomView was null, expected non-null int.'); - api.onShowCustomView(arg_instanceId!, arg_viewIdentifier!, arg_callbackIdentifier!); + api.onShowCustomView( + arg_instanceId!, arg_viewIdentifier!, arg_callbackIdentifier!); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onHideCustomView', codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onHideCustomView', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onHideCustomView was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onHideCustomView was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -2046,14 +2132,15 @@ abstract class WebChromeClientFlutterApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsShowPrompt', codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsShowPrompt', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsShowPrompt was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsShowPrompt was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -2064,21 +2151,23 @@ abstract class WebChromeClientFlutterApi { final String? arg_origin = (args[2] as String?); assert(arg_origin != null, 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsShowPrompt was null, expected non-null String.'); - api.onGeolocationPermissionsShowPrompt(arg_instanceId!, arg_paramsInstanceId!, arg_origin!); + api.onGeolocationPermissionsShowPrompt( + arg_instanceId!, arg_paramsInstanceId!, arg_origin!); return; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsHidePrompt', codec, + 'dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsHidePrompt', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsHidePrompt was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientFlutterApi.onGeolocationPermissionsHidePrompt was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2161,7 +2250,7 @@ class _FileChooserParamsFlutterApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return FileChooserModeEnumData.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -2173,11 +2262,14 @@ class _FileChooserParamsFlutterApiCodec extends StandardMessageCodec { /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.FileChooserParams. abstract class FileChooserParamsFlutterApi { - static const MessageCodec codec = _FileChooserParamsFlutterApiCodec(); + static const MessageCodec codec = + _FileChooserParamsFlutterApiCodec(); - void create(int instanceId, bool isCaptureEnabled, List acceptTypes, FileChooserModeEnumData mode, String? filenameHint); + void create(int instanceId, bool isCaptureEnabled, List acceptTypes, + FileChooserModeEnumData mode, String? filenameHint); - static void setup(FileChooserParamsFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(FileChooserParamsFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FileChooserParamsFlutterApi.create', codec, @@ -2187,7 +2279,7 @@ abstract class FileChooserParamsFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -2195,14 +2287,17 @@ abstract class FileChooserParamsFlutterApi { final bool? arg_isCaptureEnabled = (args[1] as bool?); assert(arg_isCaptureEnabled != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null bool.'); - final List? arg_acceptTypes = (args[2] as List?)?.cast(); + final List? arg_acceptTypes = + (args[2] as List?)?.cast(); assert(arg_acceptTypes != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null List.'); - final FileChooserModeEnumData? arg_mode = (args[3] as FileChooserModeEnumData?); + final FileChooserModeEnumData? arg_mode = + (args[3] as FileChooserModeEnumData?); assert(arg_mode != null, 'Argument for dev.flutter.pigeon.FileChooserParamsFlutterApi.create was null, expected non-null FileChooserModeEnumData.'); final String? arg_filenameHint = (args[4] as String?); - api.create(arg_instanceId!, arg_isCaptureEnabled!, arg_acceptTypes!, arg_mode!, arg_filenameHint); + api.create(arg_instanceId!, arg_isCaptureEnabled!, arg_acceptTypes!, + arg_mode!, arg_filenameHint); return; }); } @@ -2232,8 +2327,8 @@ class PermissionRequestHostApi { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PermissionRequestHostApi.grant', codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_resources]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_resources]) as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2287,7 +2382,8 @@ abstract class PermissionRequestFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int instanceId, List resources); - static void setup(PermissionRequestFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(PermissionRequestFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PermissionRequestFlutterApi.create', codec, @@ -2297,12 +2393,13 @@ abstract class PermissionRequestFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PermissionRequestFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.PermissionRequestFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.PermissionRequestFlutterApi.create was null, expected non-null int.'); - final List? arg_resources = (args[1] as List?)?.cast(); + final List? arg_resources = + (args[1] as List?)?.cast(); assert(arg_resources != null, 'Argument for dev.flutter.pigeon.PermissionRequestFlutterApi.create was null, expected non-null List.'); api.create(arg_instanceId!, arg_resources!); @@ -2333,7 +2430,8 @@ class CustomViewCallbackHostApi { /// Handles Dart method `CustomViewCallback.onCustomViewHidden`. Future onCustomViewHidden(int arg_identifier) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden', codec, + 'dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden', + codec, binaryMessenger: _binaryMessenger); final List? replyList = await channel.send([arg_identifier]) as List?; @@ -2367,7 +2465,8 @@ abstract class CustomViewCallbackFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int identifier); - static void setup(CustomViewCallbackFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(CustomViewCallbackFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CustomViewCallbackFlutterApi.create', codec, @@ -2377,7 +2476,7 @@ abstract class CustomViewCallbackFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CustomViewCallbackFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.CustomViewCallbackFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2413,7 +2512,7 @@ abstract class ViewFlutterApi { } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.ViewFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.ViewFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -2444,12 +2543,15 @@ class GeolocationPermissionsCallbackHostApi { static const MessageCodec codec = StandardMessageCodec(); /// Handles Dart method `GeolocationPermissionsCallback.invoke`. - Future invoke(int arg_instanceId, String arg_origin, bool arg_allow, bool arg_retain) async { + Future invoke(int arg_instanceId, String arg_origin, bool arg_allow, + bool arg_retain) async { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.GeolocationPermissionsCallbackHostApi.invoke', codec, + 'dev.flutter.pigeon.GeolocationPermissionsCallbackHostApi.invoke', + codec, binaryMessenger: _binaryMessenger); - final List? replyList = - await channel.send([arg_instanceId, arg_origin, arg_allow, arg_retain]) as List?; + final List? replyList = await channel + .send([arg_instanceId, arg_origin, arg_allow, arg_retain]) + as List?; if (replyList == null) { throw PlatformException( code: 'channel-error', @@ -2480,17 +2582,19 @@ abstract class GeolocationPermissionsCallbackFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int instanceId); - static void setup(GeolocationPermissionsCallbackFlutterApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(GeolocationPermissionsCallbackFlutterApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.GeolocationPermissionsCallbackFlutterApi.create', codec, + 'dev.flutter.pigeon.GeolocationPermissionsCallbackFlutterApi.create', + codec, binaryMessenger: binaryMessenger); if (api == null) { channel.setMessageHandler(null); } else { channel.setMessageHandler((Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.GeolocationPermissionsCallbackFlutterApi.create was null.'); + 'Argument for dev.flutter.pigeon.GeolocationPermissionsCallbackFlutterApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart index 21906e00c9e2..c558afed350c 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart @@ -149,8 +149,8 @@ class AndroidWebViewController extends PlatformWebViewController { callback.onCustomViewHidden(); return; } - final OnShowCustomViewCallback? onShowCallback = - webViewController._onShowCustomViewCallback; + final OnShowCustomWidgetCallback? onShowCallback = + webViewController._onShowCustomWidgetCallback; if (onShowCallback == null) { callback.onCustomViewHidden(); return; @@ -168,8 +168,8 @@ class AndroidWebViewController extends PlatformWebViewController { onHideCustomView: withWeakReferenceTo(this, (WeakReference weakReference) { return (android_webview.WebChromeClient instance) { - final OnHideCustomViewCallback? onHideCustomViewCallback = - weakReference.target?._onHideCustomViewCallback; + final OnHideCustomWidgetCallback? onHideCustomViewCallback = + weakReference.target?._onHideCustomWidgetCallback; if (onHideCustomViewCallback != null) { onHideCustomViewCallback(); } @@ -250,9 +250,9 @@ class AndroidWebViewController extends PlatformWebViewController { OnGeolocationPermissionsHidePrompt? _onGeolocationPermissionsHidePrompt; - OnShowCustomViewCallback? _onShowCustomViewCallback; + OnShowCustomWidgetCallback? _onShowCustomWidgetCallback; - OnHideCustomViewCallback? _onHideCustomViewCallback; + OnHideCustomWidgetCallback? _onHideCustomWidgetCallback; void Function(PlatformWebViewPermissionRequest)? _onPermissionRequestCallback; @@ -544,17 +544,19 @@ class AndroidWebViewController extends PlatformWebViewController { /// The most common use case these methods are invoked a video element wants /// to be displayed in fullscreen. /// - /// The [onShowCustomView] notifies the host application that web content - /// from the specified origin wants to be displayed in a custom view. + /// The [onShowCustomWidget] notifies the host application that web content + /// from the specified origin wants to be displayed in a custom view. After + /// this call, web content will no longer be rendered in the WebViewWidget, + /// but will instead be rendered in the custom widget. /// - /// The [onHideCustomView] notifies the host application that the custom + /// The [onHideCustomWidget] notifies the host application that the custom /// view should be hidden. - Future setCustomViewCallbacks({ - OnShowCustomViewCallback? onShowCustomView, - OnHideCustomViewCallback? onHideCustomView, + Future setCustomWidgetCallbacks({ + OnShowCustomWidgetCallback? onShowCustomWidget, + OnHideCustomWidgetCallback? onHideCustomWidget, }) async { - _onShowCustomViewCallback = onShowCustomView; - _onHideCustomViewCallback = onHideCustomView; + _onShowCustomWidgetCallback = onShowCustomWidget; + _onHideCustomWidgetCallback = onHideCustomWidget; } } @@ -602,12 +604,12 @@ typedef OnGeolocationPermissionsShowPrompt /// Signature for the `setGeolocationPermissionsPromptCallbacks` callback responsible for request the Geolocation API is cancel. typedef OnGeolocationPermissionsHidePrompt = void Function(); -/// Signature for the `setCustomViewCallbacks` callback responsible for showing the custom view. -typedef OnShowCustomViewCallback = void Function( - AndroidCustomViewWidget view, void Function() onCustomViewHidden); +/// Signature for the `setCustomWidgetCallbacks` callback responsible for showing the custom view. +typedef OnShowCustomWidgetCallback = void Function( + Widget widget, void Function() onCustomWidgetHidden); -/// Signature for the `setCustomViewCallbacks` callback responsible for hiding the custom view. -typedef OnHideCustomViewCallback = void Function(); +/// Signature for the `setCustomWidgetCallbacks` callback responsible for hiding the custom view. +typedef OnHideCustomWidgetCallback = void Function(); /// A request params used by the host application to set the Geolocation permission state for an origin. @immutable @@ -865,7 +867,12 @@ class AndroidWebViewWidget extends PlatformWebViewWidget { /// /// When adding additional fields make sure they can be null or have a default /// value to avoid breaking changes. +/// +/// The [AndroidCustomViewWidgetCreationParams] are used internally only to +/// instantiate the [AndroidCustomViewWidget]. This class is visible for +/// testing purposes only and should not be used externally. @immutable +@visibleForTesting class AndroidCustomViewWidgetCreationParams { /// Creates [AndroidCustomViewWidgetCreationParams]. AndroidCustomViewWidgetCreationParams({ @@ -937,7 +944,12 @@ class AndroidCustomViewWidgetCreationParams { /// /// The [AndroidCustomViewWidget] cannot be manually instantiated and is /// provided to the host application through the callbacks specified using the -/// [AndroidWebViewController.setCustomViewCallbacks] method. +/// [AndroidWebViewController.setCustomWidgetCallbacks] method. +/// +/// The [AndroidCustomViewWidget] is initialized internally and should only be +/// exposed as a [Widget] externally. The type [AndroidCustomViewWidget] is +/// visible for testing purposes only and should never be called externally. +@visibleForTesting class AndroidCustomViewWidget extends StatelessWidget { /// Creates a [AndroidCustomViewWidget]. /// diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart index fc2f41235942..f22695bbd2dd 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart @@ -761,12 +761,12 @@ void main() { bool showCustomViewCalled = false; bool hideCustomViewCalled = false; - controller.setCustomViewCallbacks( - onShowCustomView: (AndroidCustomViewWidget widget, - OnHideCustomViewCallback callback) async { + await controller.setCustomWidgetCallbacks( + onShowCustomWidget: + (Widget widget, OnHideCustomWidgetCallback callback) async { showCustomViewCalled = true; }, - onHideCustomView: () { + onHideCustomWidget: () { hideCustomViewCalled = true; }, ); diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart index 3037ff10b917..b6d6e2c574a8 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.mocks.dart @@ -738,17 +738,17 @@ class MockAndroidWebViewController extends _i1.Mock returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - _i9.Future setCustomViewCallbacks({ - _i8.OnShowCustomViewCallback? onShowCustomView, - _i8.OnHideCustomViewCallback? onHideCustomView, + _i9.Future setCustomWidgetCallbacks({ + _i8.OnShowCustomWidgetCallback? onShowCustomWidget, + _i8.OnHideCustomWidgetCallback? onHideCustomWidget, }) => (super.noSuchMethod( Invocation.method( - #setCustomViewCallbacks, + #setCustomWidgetCallbacks, [], { - #onShowCustomView: onShowCustomView, - #onHideCustomView: onHideCustomView, + #onShowCustomWidget: onShowCustomWidget, + #onHideCustomWidget: onHideCustomWidget, }, ), returnValue: _i9.Future.value(), diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart index 2e0e83b848b0..b23bcaa24a2a 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart @@ -474,17 +474,17 @@ class MockAndroidWebViewController extends _i1.Mock returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override - _i5.Future setCustomViewCallbacks({ - _i6.OnShowCustomViewCallback? onShowCustomView, - _i6.OnHideCustomViewCallback? onHideCustomView, + _i5.Future setCustomWidgetCallbacks({ + _i6.OnShowCustomWidgetCallback? onShowCustomWidget, + _i6.OnHideCustomWidgetCallback? onHideCustomWidget, }) => (super.noSuchMethod( Invocation.method( - #setCustomViewCallbacks, + #setCustomWidgetCallbacks, [], { - #onShowCustomView: onShowCustomView, - #onHideCustomView: onHideCustomView, + #onShowCustomWidget: onShowCustomWidget, + #onHideCustomWidget: onHideCustomWidget, }, ), returnValue: _i5.Future.value(), diff --git a/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart index 0989cb63b423..1726f345abe8 100644 --- a/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart +++ b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart @@ -15,7 +15,8 @@ import 'package:webview_flutter_android/src/android_webview.g.dart'; /// Host API for managing the native `InstanceManager`. abstract class TestInstanceManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Clear the native `InstanceManager`. @@ -23,15 +24,19 @@ abstract class TestInstanceManagerHostApi { /// This is typically only used after a hot restart. void clear(); - static void setup(TestInstanceManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestInstanceManagerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.InstanceManagerHostApi.clear', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { // ignore message api.clear(); return []; @@ -47,22 +52,27 @@ abstract class TestInstanceManagerHostApi { /// /// See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. abstract class TestJavaObjectHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void dispose(int identifier); - static void setup(TestJavaObjectHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestJavaObjectHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaObjectHostApi.dispose', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -81,7 +91,8 @@ abstract class TestJavaObjectHostApi { /// are attached to a Dart instance or handle method calls on the associated /// native class or an instance of the class. abstract class TestCookieManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Handles attaching `CookieManager.instance` to a native instance. @@ -94,19 +105,24 @@ abstract class TestCookieManagerHostApi { Future removeAllCookies(int identifier); /// Handles Dart method `CookieManager.setAcceptThirdPartyCookies`. - void setAcceptThirdPartyCookies(int identifier, int webViewIdentifier, bool accept); + void setAcceptThirdPartyCookies( + int identifier, int webViewIdentifier, bool accept); - static void setup(TestCookieManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestCookieManagerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.CookieManagerHostApi.attachInstance', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CookieManagerHostApi.attachInstance was null.'); + 'Argument for dev.flutter.pigeon.CookieManagerHostApi.attachInstance was null.'); final List args = (message as List?)!; final int? arg_instanceIdentifier = (args[0] as int?); assert(arg_instanceIdentifier != null, @@ -121,11 +137,14 @@ abstract class TestCookieManagerHostApi { 'dev.flutter.pigeon.CookieManagerHostApi.setCookie', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setCookie was null.'); + 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setCookie was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -146,11 +165,14 @@ abstract class TestCookieManagerHostApi { 'dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies was null.'); + 'Argument for dev.flutter.pigeon.CookieManagerHostApi.removeAllCookies was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -162,14 +184,18 @@ abstract class TestCookieManagerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies', codec, + 'dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies was null.'); + 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -180,7 +206,8 @@ abstract class TestCookieManagerHostApi { final bool? arg_accept = (args[2] as bool?); assert(arg_accept != null, 'Argument for dev.flutter.pigeon.CookieManagerHostApi.setAcceptThirdPartyCookies was null, expected non-null bool.'); - api.setAcceptThirdPartyCookies(arg_identifier!, arg_webViewIdentifier!, arg_accept!); + api.setAcceptThirdPartyCookies( + arg_identifier!, arg_webViewIdentifier!, arg_accept!); return []; }); } @@ -203,7 +230,7 @@ class _TestWebViewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebViewPoint.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -212,14 +239,17 @@ class _TestWebViewHostApiCodec extends StandardMessageCodec { } abstract class TestWebViewHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestWebViewHostApiCodec(); void create(int instanceId); - void loadData(int instanceId, String data, String? mimeType, String? encoding); + void loadData( + int instanceId, String data, String? mimeType, String? encoding); - void loadDataWithBaseUrl(int instanceId, String? baseUrl, String data, String? mimeType, String? encoding, String? historyUrl); + void loadDataWithBaseUrl(int instanceId, String? baseUrl, String data, + String? mimeType, String? encoding, String? historyUrl); void loadUrl(int instanceId, String url, Map headers); @@ -267,17 +297,21 @@ abstract class TestWebViewHostApi { void setBackgroundColor(int instanceId, int color); - static void setup(TestWebViewHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebViewHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -292,11 +326,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.loadData', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -316,11 +353,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -332,7 +372,8 @@ abstract class TestWebViewHostApi { final String? arg_mimeType = (args[3] as String?); final String? arg_encoding = (args[4] as String?); final String? arg_historyUrl = (args[5] as String?); - api.loadDataWithBaseUrl(arg_instanceId!, arg_baseUrl, arg_data!, arg_mimeType, arg_encoding, arg_historyUrl); + api.loadDataWithBaseUrl(arg_instanceId!, arg_baseUrl, arg_data!, + arg_mimeType, arg_encoding, arg_historyUrl); return []; }); } @@ -342,11 +383,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.loadUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -354,7 +398,8 @@ abstract class TestWebViewHostApi { final String? arg_url = (args[1] as String?); assert(arg_url != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null String.'); - final Map? arg_headers = (args[2] as Map?)?.cast(); + final Map? arg_headers = + (args[2] as Map?)?.cast(); assert(arg_headers != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null Map.'); api.loadUrl(arg_instanceId!, arg_url!, arg_headers!); @@ -367,11 +412,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.postUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -392,11 +440,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -411,11 +462,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.canGoBack', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoBack was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -430,11 +484,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.canGoForward', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoForward was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -449,11 +506,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.goBack', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.goBack was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.goBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -468,11 +528,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.goForward', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.goForward was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.goForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -487,11 +550,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.reload', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.reload was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.reload was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -506,11 +572,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.clearCache', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -528,11 +597,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.evaluateJavascript', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -540,7 +612,8 @@ abstract class TestWebViewHostApi { final String? arg_javascriptString = (args[1] as String?); assert(arg_javascriptString != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null, expected non-null String.'); - final String? output = await api.evaluateJavascript(arg_instanceId!, arg_javascriptString!); + final String? output = await api.evaluateJavascript( + arg_instanceId!, arg_javascriptString!); return [output]; }); } @@ -550,11 +623,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getTitle', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getTitle was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getTitle was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -569,11 +645,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.scrollTo', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -594,11 +673,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.scrollBy', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -619,11 +701,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getScrollX', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollX was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollX was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -638,11 +723,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getScrollY', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollY was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollY was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -657,11 +745,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getScrollPosition', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollPosition was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollPosition was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -673,14 +764,18 @@ abstract class TestWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', codec, + 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled was null.'); final List args = (message as List?)!; final bool? arg_enabled = (args[0] as bool?); assert(arg_enabled != null, @@ -695,11 +790,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setWebViewClient', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -717,11 +815,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -729,7 +830,8 @@ abstract class TestWebViewHostApi { final int? arg_javaScriptChannelInstanceId = (args[1] as int?); assert(arg_javaScriptChannelInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null, expected non-null int.'); - api.addJavaScriptChannel(arg_instanceId!, arg_javaScriptChannelInstanceId!); + api.addJavaScriptChannel( + arg_instanceId!, arg_javaScriptChannelInstanceId!); return []; }); } @@ -739,11 +841,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -751,7 +856,8 @@ abstract class TestWebViewHostApi { final int? arg_javaScriptChannelInstanceId = (args[1] as int?); assert(arg_javaScriptChannelInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null, expected non-null int.'); - api.removeJavaScriptChannel(arg_instanceId!, arg_javaScriptChannelInstanceId!); + api.removeJavaScriptChannel( + arg_instanceId!, arg_javaScriptChannelInstanceId!); return []; }); } @@ -761,11 +867,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setDownloadListener', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -781,11 +890,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setWebChromeClient', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -801,11 +913,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setBackgroundColor', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -822,7 +937,8 @@ abstract class TestWebViewHostApi { } abstract class TestWebSettingsHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId, int webViewInstanceId); @@ -853,17 +969,21 @@ abstract class TestWebSettingsHostApi { void setTextZoom(int instanceId, int textZoom); - static void setup(TestWebSettingsHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebSettingsHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -881,11 +1001,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -900,14 +1023,18 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -915,21 +1042,26 @@ abstract class TestWebSettingsHostApi { final bool? arg_flag = (args[1] as bool?); assert(arg_flag != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null, expected non-null bool.'); - api.setJavaScriptCanOpenWindowsAutomatically(arg_instanceId!, arg_flag!); + api.setJavaScriptCanOpenWindowsAutomatically( + arg_instanceId!, arg_flag!); return []; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -947,11 +1079,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -969,11 +1104,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -986,14 +1124,18 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1001,7 +1143,8 @@ abstract class TestWebSettingsHostApi { final bool? arg_require = (args[1] as bool?); assert(arg_require != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null, expected non-null bool.'); - api.setMediaPlaybackRequiresUserGesture(arg_instanceId!, arg_require!); + api.setMediaPlaybackRequiresUserGesture( + arg_instanceId!, arg_require!); return []; }); } @@ -1011,11 +1154,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1030,14 +1176,18 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1055,11 +1205,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1077,11 +1230,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1099,11 +1255,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1121,11 +1280,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1143,11 +1305,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setTextZoom', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setTextZoom was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setTextZoom was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1164,22 +1329,27 @@ abstract class TestWebSettingsHostApi { } abstract class TestJavaScriptChannelHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId, String channelName); - static void setup(TestJavaScriptChannelHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestJavaScriptChannelHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1196,24 +1366,30 @@ abstract class TestJavaScriptChannelHostApi { } abstract class TestWebViewClientHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - void setSynchronousReturnValueForShouldOverrideUrlLoading(int instanceId, bool value); + void setSynchronousReturnValueForShouldOverrideUrlLoading( + int instanceId, bool value); - static void setup(TestWebViewClientHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebViewClientHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewClientHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1225,14 +1401,18 @@ abstract class TestWebViewClientHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', codec, + 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1240,7 +1420,8 @@ abstract class TestWebViewClientHostApi { final bool? arg_value = (args[1] as bool?); assert(arg_value != null, 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null, expected non-null bool.'); - api.setSynchronousReturnValueForShouldOverrideUrlLoading(arg_instanceId!, arg_value!); + api.setSynchronousReturnValueForShouldOverrideUrlLoading( + arg_instanceId!, arg_value!); return []; }); } @@ -1249,22 +1430,27 @@ abstract class TestWebViewClientHostApi { } abstract class TestDownloadListenerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - static void setup(TestDownloadListenerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestDownloadListenerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.DownloadListenerHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.DownloadListenerHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.DownloadListenerHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1278,24 +1464,30 @@ abstract class TestDownloadListenerHostApi { } abstract class TestWebChromeClientHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - void setSynchronousReturnValueForOnShowFileChooser(int instanceId, bool value); + void setSynchronousReturnValueForOnShowFileChooser( + int instanceId, bool value); - static void setup(TestWebChromeClientHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebChromeClientHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebChromeClientHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1307,14 +1499,18 @@ abstract class TestWebChromeClientHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', codec, + 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1322,7 +1518,8 @@ abstract class TestWebChromeClientHostApi { final bool? arg_value = (args[1] as bool?); assert(arg_value != null, 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null, expected non-null bool.'); - api.setSynchronousReturnValueForOnShowFileChooser(arg_instanceId!, arg_value!); + api.setSynchronousReturnValueForOnShowFileChooser( + arg_instanceId!, arg_value!); return []; }); } @@ -1331,24 +1528,29 @@ abstract class TestWebChromeClientHostApi { } abstract class TestAssetManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); List list(String path); String getAssetFilePathByName(String name); - static void setup(TestAssetManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestAssetManagerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FlutterAssetManagerHostApi.list', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.list was null.'); + 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.list was null.'); final List args = (message as List?)!; final String? arg_path = (args[0] as String?); assert(arg_path != null, @@ -1360,14 +1562,18 @@ abstract class TestAssetManagerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', codec, + 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName was null.'); + 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName was null.'); final List args = (message as List?)!; final String? arg_name = (args[0] as String?); assert(arg_name != null, @@ -1381,24 +1587,29 @@ abstract class TestAssetManagerHostApi { } abstract class TestWebStorageHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); void deleteAllData(int instanceId); - static void setup(TestWebStorageHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebStorageHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebStorageHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebStorageHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebStorageHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1413,11 +1624,14 @@ abstract class TestWebStorageHostApi { 'dev.flutter.pigeon.WebStorageHostApi.deleteAllData', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebStorageHostApi.deleteAllData was null.'); + 'Argument for dev.flutter.pigeon.WebStorageHostApi.deleteAllData was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1438,7 +1652,8 @@ abstract class TestWebStorageHostApi { /// /// See https://developer.android.com/reference/android/webkit/PermissionRequest. abstract class TestPermissionRequestHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Handles Dart method `PermissionRequest.grant`. @@ -1447,22 +1662,27 @@ abstract class TestPermissionRequestHostApi { /// Handles Dart method `PermissionRequest.deny`. void deny(int instanceId); - static void setup(TestPermissionRequestHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestPermissionRequestHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PermissionRequestHostApi.grant', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null.'); + 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null, expected non-null int.'); - final List? arg_resources = (args[1] as List?)?.cast(); + final List? arg_resources = + (args[1] as List?)?.cast(); assert(arg_resources != null, 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null, expected non-null List.'); api.grant(arg_instanceId!, arg_resources!); @@ -1475,11 +1695,14 @@ abstract class TestPermissionRequestHostApi { 'dev.flutter.pigeon.PermissionRequestHostApi.deny', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.deny was null.'); + 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.deny was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1500,23 +1723,29 @@ abstract class TestPermissionRequestHostApi { /// /// See https://developer.android.com/reference/android/webkit/WebChromeClient.CustomViewCallback. abstract class TestCustomViewCallbackHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Handles Dart method `CustomViewCallback.onCustomViewHidden`. void onCustomViewHidden(int identifier); - static void setup(TestCustomViewCallbackHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestCustomViewCallbackHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden', codec, + 'dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden was null.'); + 'Argument for dev.flutter.pigeon.CustomViewCallbackHostApi.onCustomViewHidden was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -1537,23 +1766,29 @@ abstract class TestCustomViewCallbackHostApi { /// /// See https://developer.android.com/reference/android/webkit/GeolocationPermissions.Callback. abstract class TestGeolocationPermissionsCallbackHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Handles Dart method `GeolocationPermissionsCallback.invoke`. void invoke(int instanceId, String origin, bool allow, bool retain); - static void setup(TestGeolocationPermissionsCallbackHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestGeolocationPermissionsCallbackHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.GeolocationPermissionsCallbackHostApi.invoke', codec, + 'dev.flutter.pigeon.GeolocationPermissionsCallbackHostApi.invoke', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.GeolocationPermissionsCallbackHostApi.invoke was null.'); + 'Argument for dev.flutter.pigeon.GeolocationPermissionsCallbackHostApi.invoke was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, From ab876f249dc742ed2b38d622b0b7ac1f3d571d39 Mon Sep 17 00:00:00 2001 From: Maurits van Beusekom Date: Wed, 12 Jul 2023 18:17:55 +0200 Subject: [PATCH 21/35] Applied PR feedback --- .../lib/src/android_webview_controller.dart | 108 +++++------------- .../test/android_webview_controller_test.dart | 61 +--------- 2 files changed, 33 insertions(+), 136 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart index c558afed350c..77dfd5400b78 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart @@ -155,12 +155,11 @@ class AndroidWebViewController extends PlatformWebViewController { callback.onCustomViewHidden(); return; } - final AndroidCustomViewWidgetCreationParams creationParams = - AndroidCustomViewWidgetCreationParams( - controller: webViewController, customView: view); - onShowCallback( - AndroidCustomViewWidget.private(creationParams: creationParams), + AndroidCustomViewWidget.private( + controller: webViewController, + customView: view, + ), () => callback.onCustomViewHidden(), ); }; @@ -863,24 +862,29 @@ class AndroidWebViewWidget extends PlatformWebViewWidget { } } -/// Object specifying creation parameters for creating a [AndroidCustomViewWidget]. +/// Represents a Flutter implementation of the Android [View](https://developer.android.com/reference/android/view/View) +/// that is created by the host platform when web content needs to be displayed +/// in fullscreen mode. /// -/// When adding additional fields make sure they can be null or have a default -/// value to avoid breaking changes. +/// The [AndroidCustomViewWidget] cannot be manually instantiated and is +/// provided to the host application through the callbacks specified using the +/// [AndroidWebViewController.setCustomWidgetCallbacks] method. /// -/// The [AndroidCustomViewWidgetCreationParams] are used internally only to -/// instantiate the [AndroidCustomViewWidget]. This class is visible for -/// testing purposes only and should not be used externally. -@immutable +/// The [AndroidCustomViewWidget] is initialized internally and should only be +/// exposed as a [Widget] externally. The type [AndroidCustomViewWidget] is +/// visible for testing purposes only and should never be called externally. @visibleForTesting -class AndroidCustomViewWidgetCreationParams { - /// Creates [AndroidCustomViewWidgetCreationParams]. - AndroidCustomViewWidgetCreationParams({ +class AndroidCustomViewWidget extends StatelessWidget { + /// Creates a [AndroidCustomViewWidget]. + /// + /// The [AndroidCustomViewWidget] should only be instantiated internally. + /// This constructor is visible for testing purposes only and should + /// never be called externally. + @visibleForTesting + AndroidCustomViewWidget.private({ + super.key, required this.controller, required this.customView, - this.layoutDirection = TextDirection.ltr, - this.gestureRecognizers = const >{}, - this.displayWithHybridComposition = false, @visibleForTesting InstanceManager? instanceManager, @visibleForTesting this.platformViewsServiceProxy = const PlatformViewsServiceProxy(), @@ -894,22 +898,6 @@ class AndroidCustomViewWidgetCreationParams { /// view. final PlatformWebViewController controller; - /// The layout direction to use for the embedded WebView. - final TextDirection layoutDirection; - - /// The `gestureRecognizers` specifies which gestures should be consumed by the - /// web view. - /// - /// It is possible for other gesture recognizers to be competing with the web - /// view on pointer events, e.g. if the web view is inside a [ListView] the - /// [ListView] will want to handle vertical drags. The web view will claim - /// gestures that are recognized by any of the recognizers on this list. - /// - /// When `gestureRecognizers` is empty (default), the web view will only handle - /// pointer events for gestures that were not claimed by any other gesture - /// recognizer. - final Set> gestureRecognizers; - /// Maintains instances used to communicate with the native objects they /// represent. /// @@ -924,46 +912,6 @@ class AndroidCustomViewWidgetCreationParams { @visibleForTesting final PlatformViewsServiceProxy platformViewsServiceProxy; - /// Whether the [WebView] will be displayed using the Hybrid Composition - /// PlatformView implementation. - /// - /// For most use cases, this flag should be set to false. Hybrid Composition - /// can have performance costs but doesn't have the limitation of rendering to - /// an Android SurfaceTexture. See - /// * https://flutter.dev/docs/development/platform-integration/platform-views#performance - /// * https://github.com/flutter/flutter/issues/104889 - /// * https://github.com/flutter/flutter/issues/116954 - /// - /// Defaults to false. - final bool displayWithHybridComposition; -} - -/// Represents a Flutter implementation of the Android [View](https://developer.android.com/reference/android/view/View) -/// that is created by the host platform when web content needs to be displayed -/// in fullscreen mode. -/// -/// The [AndroidCustomViewWidget] cannot be manually instantiated and is -/// provided to the host application through the callbacks specified using the -/// [AndroidWebViewController.setCustomWidgetCallbacks] method. -/// -/// The [AndroidCustomViewWidget] is initialized internally and should only be -/// exposed as a [Widget] externally. The type [AndroidCustomViewWidget] is -/// visible for testing purposes only and should never be called externally. -@visibleForTesting -class AndroidCustomViewWidget extends StatelessWidget { - /// Creates a [AndroidCustomViewWidget]. - /// - /// The [AndroidCustomViewWidget] should only be instantiated internally. - /// This constructor is visible for testing purposes only and should - /// never be called externally. - @visibleForTesting - const AndroidCustomViewWidget.private({ - super.key, - required AndroidCustomViewWidgetCreationParams creationParams, - }) : _creationParams = creationParams; - - final AndroidCustomViewWidgetCreationParams _creationParams; - @override Widget build(BuildContext context) { return PlatformViewLink( @@ -976,18 +924,16 @@ class AndroidCustomViewWidget extends StatelessWidget { return AndroidViewSurface( controller: controller as AndroidViewController, hitTestBehavior: PlatformViewHitTestBehavior.opaque, - gestureRecognizers: _creationParams.gestureRecognizers, + gestureRecognizers: const >{}, ); }, onCreatePlatformView: (PlatformViewCreationParams params) { return _initAndroidView( params, - displayWithHybridComposition: - _creationParams.displayWithHybridComposition, - platformViewsServiceProxy: _creationParams.platformViewsServiceProxy, - view: _creationParams.customView, - instanceManager: _creationParams.instanceManager, - layoutDirection: _creationParams.layoutDirection, + displayWithHybridComposition: false, + platformViewsServiceProxy: platformViewsServiceProxy, + view: customView, + instanceManager: instanceManager, ) ..addOnPlatformViewCreatedListener(params.onPlatformViewCreated) ..create(); diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart index f22695bbd2dd..318552a1da2c 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart @@ -1320,10 +1320,8 @@ void main() { final AndroidCustomViewWidget customViewWidget = AndroidCustomViewWidget.private( key: const Key('test_custom_view'), - creationParams: AndroidCustomViewWidgetCreationParams( - customView: android_webview.View.detached(), - controller: controller, - ), + customView: android_webview.View.detached(), + controller: controller, ); await tester.pumpWidget(Builder( @@ -1334,7 +1332,7 @@ void main() { expect(find.byKey(const Key('test_custom_view')), findsOneWidget); }); - testWidgets('displayWithHybridComposition is false', + testWidgets('displayWithHybridComposition should be false', (WidgetTester tester) async { final AndroidWebViewController controller = createControllerWithMocks(); @@ -1354,11 +1352,9 @@ void main() { final AndroidCustomViewWidget customViewWidget = AndroidCustomViewWidget.private( - creationParams: AndroidCustomViewWidgetCreationParams( - controller: controller, - customView: android_webview.View.detached(), - platformViewsServiceProxy: mockPlatformViewsService, - ), + controller: controller, + customView: android_webview.View.detached(), + platformViewsServiceProxy: mockPlatformViewsService, ); await tester.pumpWidget(Builder( @@ -1377,50 +1373,5 @@ void main() { ), ); }); - - testWidgets('displayWithHybridComposition is true', - (WidgetTester tester) async { - final AndroidWebViewController controller = createControllerWithMocks(); - - final MockPlatformViewsServiceProxy mockPlatformViewsService = - MockPlatformViewsServiceProxy(); - - when( - mockPlatformViewsService.initExpensiveAndroidView( - id: anyNamed('id'), - viewType: anyNamed('viewType'), - layoutDirection: anyNamed('layoutDirection'), - creationParams: anyNamed('creationParams'), - creationParamsCodec: anyNamed('creationParamsCodec'), - onFocus: anyNamed('onFocus'), - ), - ).thenReturn(MockExpensiveAndroidViewController()); - - final AndroidCustomViewWidget webViewWidget = - AndroidCustomViewWidget.private( - creationParams: AndroidCustomViewWidgetCreationParams( - controller: controller, - customView: android_webview.View.detached(), - platformViewsServiceProxy: mockPlatformViewsService, - displayWithHybridComposition: true, - ), - ); - - await tester.pumpWidget(Builder( - builder: (BuildContext context) => webViewWidget.build(context), - )); - await tester.pumpAndSettle(); - - verify( - mockPlatformViewsService.initExpensiveAndroidView( - id: anyNamed('id'), - viewType: anyNamed('viewType'), - layoutDirection: anyNamed('layoutDirection'), - creationParams: anyNamed('creationParams'), - creationParamsCodec: anyNamed('creationParamsCodec'), - onFocus: anyNamed('onFocus'), - ), - ); - }); }); } From c612ef54127552f967c717a399ea9e28b500cc53 Mon Sep 17 00:00:00 2001 From: Maurits van Beusekom Date: Thu, 3 Aug 2023 13:43:21 +0200 Subject: [PATCH 22/35] Adds integration test to validate fullscreen --- .../webview_flutter_test.dart | 99 ++++++++++++++++++- 1 file changed, 96 insertions(+), 3 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart index 53b8a0078fd0..1b2783cbefc3 100644 --- a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart @@ -356,6 +356,19 @@ Future main() async { final String videoTest = ''' Video auto play + - +
+
+ +
'''; @@ -509,6 +541,67 @@ Future main() async { .runJavaScriptReturningResult('isFullScreen();') as bool; expect(fullScreen, false); }); + + testWidgets('Video plays fullscreen', (WidgetTester tester) async { + final Completer fullscreenEntered = Completer(); + final Completer fullscreenExited = Completer(); + final Completer pageLoaded = Completer(); + + final AndroidWebViewController controller = AndroidWebViewController( + const PlatformWebViewControllerCreationParams(), + ); + unawaited(controller.setJavaScriptMode(JavaScriptMode.unrestricted)); + unawaited(controller.setMediaPlaybackRequiresUserGesture(false)); + final AndroidNavigationDelegate delegate = AndroidNavigationDelegate( + const PlatformNavigationDelegateCreationParams(), + ); + unawaited(delegate.setOnPageFinished((_) => pageLoaded.complete())); + unawaited(controller.setPlatformNavigationDelegate(delegate)); + unawaited(controller.setCustomWidgetCallbacks(onHideCustomWidget: () { + fullscreenExited.complete(); + }, onShowCustomWidget: + (Widget webView, void Function()? onHideCustomView) { + fullscreenEntered.complete(); + onHideCustomView!(); + })); + + unawaited(controller.addJavaScriptChannel( + JavaScriptChannelParams( + name: 'LogChannel', + onMessageReceived: (JavaScriptMessage message) { + print(message.message); + }, + ), + )); + + await controller.loadRequest( + LoadRequestParams( + uri: Uri.parse( + 'data:text/html;charset=utf-8;base64,$videoTestBase64', + ), + ), + ); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) { + return PlatformWebViewWidget( + PlatformWebViewWidgetCreationParams( + key: const Key('webview_widget'), + controller: controller, + ), + ).build(context); + }, + )); + + await pageLoaded.future; + + await tester.pumpAndSettle(const Duration(seconds: 3)); + + await tester.tapAt(const Offset(20, 20)); + + await expectLater(fullscreenEntered.future, completes); + await expectLater(fullscreenExited.future, completes); + }); }); group('Audio playback policy', () { From 041441de233e9a26bc0543b3d6e916646df306e6 Mon Sep 17 00:00:00 2001 From: Maurits van Beusekom Date: Thu, 3 Aug 2023 19:47:04 +0200 Subject: [PATCH 23/35] Ensure the CustomViewHostApi is setup correctly --- .../flutter/plugins/webviewflutter/WebViewFlutterPlugin.java | 4 ++++ .../example/integration_test/webview_flutter_test.dart | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java index 44d955bd76e7..7eb80c30dadd 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java @@ -15,6 +15,7 @@ import io.flutter.plugin.common.BinaryMessenger; import io.flutter.plugin.platform.PlatformViewRegistry; import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.CookieManagerHostApi; +import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.CustomViewCallbackHostApi; import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.DownloadListenerHostApi; import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.FlutterAssetManagerHostApi; import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.GeolocationPermissionsCallbackHostApi; @@ -141,6 +142,9 @@ private void setUp( GeolocationPermissionsCallbackHostApi.setup( binaryMessenger, new GeolocationPermissionsCallbackHostApiImpl(binaryMessenger, instanceManager)); + CustomViewCallbackHostApi.setup( + binaryMessenger, + new CustomViewCallbackHostApiImpl(binaryMessenger, instanceManager)); } @Override diff --git a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart index 1b2783cbefc3..95cbbebb3847 100644 --- a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart @@ -595,7 +595,7 @@ Future main() async { await pageLoaded.future; - await tester.pumpAndSettle(const Duration(seconds: 3)); + await tester.pumpAndSettle(); await tester.tapAt(const Offset(20, 20)); From 5ef97bc784c9dfd30a7971bb89c16ef573452254 Mon Sep 17 00:00:00 2001 From: Maurits van Beusekom Date: Fri, 11 Aug 2023 21:52:50 +0200 Subject: [PATCH 24/35] Remove obsolete file --- .../webview_flutter_android/lib/test | 1426 ----------------- 1 file changed, 1426 deletions(-) delete mode 100644 packages/webview_flutter/webview_flutter_android/lib/test diff --git a/packages/webview_flutter/webview_flutter_android/lib/test b/packages/webview_flutter/webview_flutter_android/lib/test deleted file mode 100644 index 5bc73c997256..000000000000 --- a/packages/webview_flutter/webview_flutter_android/lib/test +++ /dev/null @@ -1,1426 +0,0 @@ -// 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/material.dart'; -import 'package:flutter/services.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:mockito/annotations.dart'; -import 'package:mockito/mockito.dart'; -import 'package:webview_flutter_android/src/android_proxy.dart'; -import 'package:webview_flutter_android/src/android_webview.dart' - as android_webview; -import 'package:webview_flutter_android/src/android_webview_api_impls.dart'; -import 'package:webview_flutter_android/src/instance_manager.dart'; -import 'package:webview_flutter_android/src/platform_views_service_proxy.dart'; -import 'package:webview_flutter_android/webview_flutter_android.dart'; -import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart'; - -import 'android_navigation_delegate_test.dart'; -import 'android_webview_controller_test.mocks.dart'; -import 'android_webview_test.mocks.dart' - show - MockTestGeolocationPermissionsCallbackHostApi, - MockTestCustomViewCallbackHostApi; -import 'test_android_webview.g.dart'; - -@GenerateNiceMocks(>[ - MockSpec(), - MockSpec(), - MockSpec(), - MockSpec(), - MockSpec(), - MockSpec(), - MockSpec(), - MockSpec(), - MockSpec(), - MockSpec(), - MockSpec(), - MockSpec(), - MockSpec(), - MockSpec(), - MockSpec(), - MockSpec(), - MockSpec(), -]) -void main() { - TestWidgetsFlutterBinding.ensureInitialized(); - - // Mocks the call to clear the native InstanceManager. - TestInstanceManagerHostApi.setup(MockTestInstanceManagerHostApi()); - - AndroidWebViewController createControllerWithMocks({ - android_webview.FlutterAssetManager? mockFlutterAssetManager, - android_webview.JavaScriptChannel? mockJavaScriptChannel, - android_webview.WebChromeClient Function({ - void Function(android_webview.WebView webView, int progress)? - onProgressChanged, - Future> Function( - android_webview.WebView webView, - android_webview.FileChooserParams params, - )? onShowFileChooser, - android_webview.GeolocationPermissionsShowPrompt? - onGeolocationPermissionsShowPrompt, - android_webview.GeolocationPermissionsHidePrompt? - onGeolocationPermissionsHidePrompt, - void Function( - android_webview.WebChromeClient instance, - android_webview.PermissionRequest request, - )? onPermissionRequest, - void Function( - android_webview.WebChromeClient instance, - android_webview.View view, - android_webview.CustomViewCallback callback)? - onShowCustomView, - void Function(android_webview.WebChromeClient instance)? onHideCustomView, - })? createWebChromeClient, - android_webview.WebView? mockWebView, - android_webview.WebViewClient? mockWebViewClient, - android_webview.WebStorage? mockWebStorage, - android_webview.WebSettings? mockSettings, - }) { - final android_webview.WebView nonNullMockWebView = - mockWebView ?? MockWebView(); - - final AndroidWebViewControllerCreationParams creationParams = - AndroidWebViewControllerCreationParams( - androidWebStorage: mockWebStorage ?? MockWebStorage(), - androidWebViewProxy: AndroidWebViewProxy( - createAndroidWebChromeClient: createWebChromeClient ?? - ({ - void Function(android_webview.WebView, int)? - onProgressChanged, - Future> Function( - android_webview.WebView webView, - android_webview.FileChooserParams params, - )? onShowFileChooser, - void Function( - android_webview.WebChromeClient instance, - android_webview.PermissionRequest request, - )? onPermissionRequest, - Future Function( - String origin, - android_webview.GeolocationPermissionsCallback callback, - )? onGeolocationPermissionsShowPrompt, - void Function(android_webview.WebChromeClient instance)? - onGeolocationPermissionsHidePrompt, - void Function( - android_webview.WebChromeClient instance, - android_webview.View view, - android_webview.CustomViewCallback callback)? - onShowCustomView, - void Function(android_webview.WebChromeClient instance)? - onHideCustomView, - }) => - MockWebChromeClient(), - createAndroidWebView: () => nonNullMockWebView, - createAndroidWebViewClient: ({ - void Function(android_webview.WebView webView, String url)? - onPageFinished, - void Function(android_webview.WebView webView, String url)? - onPageStarted, - @Deprecated('Only called on Android version < 23.') - void Function( - android_webview.WebView webView, - int errorCode, - String description, - String failingUrl, - )? onReceivedError, - void Function( - android_webview.WebView webView, - android_webview.WebResourceRequest request, - android_webview.WebResourceError error, - )? onReceivedRequestError, - void Function( - android_webview.WebView webView, - android_webview.WebResourceRequest request, - )? requestLoading, - void Function(android_webview.WebView webView, String url)? - urlLoading, - void Function( - android_webview.WebView webView, - String url, - bool isReload, - )? doUpdateVisitedHistory, - }) => - mockWebViewClient ?? MockWebViewClient(), - createFlutterAssetManager: () => - mockFlutterAssetManager ?? MockFlutterAssetManager(), - createJavaScriptChannel: ( - String channelName, { - required void Function(String) postMessage, - }) => - mockJavaScriptChannel ?? MockJavaScriptChannel(), - )); - - when(nonNullMockWebView.settings) - .thenReturn(mockSettings ?? MockWebSettings()); - - return AndroidWebViewController(creationParams); - } - - group('AndroidWebViewController', () { - AndroidJavaScriptChannelParams - createAndroidJavaScriptChannelParamsWithMocks({ - String? name, - MockJavaScriptChannel? mockJavaScriptChannel, - }) { - return AndroidJavaScriptChannelParams( - name: name ?? 'test', - onMessageReceived: (JavaScriptMessage message) {}, - webViewProxy: AndroidWebViewProxy( - createJavaScriptChannel: ( - String channelName, { - required void Function(String) postMessage, - }) => - mockJavaScriptChannel ?? MockJavaScriptChannel(), - )); - } - - test('loadFile without file prefix', () async { - final MockWebView mockWebView = MockWebView(); - final MockWebSettings mockWebSettings = MockWebSettings(); - createControllerWithMocks( - mockWebView: mockWebView, - mockSettings: mockWebSettings, - ); - - verify(mockWebSettings.setBuiltInZoomControls(true)).called(1); - verify(mockWebSettings.setDisplayZoomControls(false)).called(1); - verify(mockWebSettings.setDomStorageEnabled(true)).called(1); - verify(mockWebSettings.setJavaScriptCanOpenWindowsAutomatically(true)) - .called(1); - verify(mockWebSettings.setLoadWithOverviewMode(true)).called(1); - verify(mockWebSettings.setSupportMultipleWindows(true)).called(1); - verify(mockWebSettings.setUseWideViewPort(true)).called(1); - }); - - test('loadFile without file prefix', () async { - final MockWebView mockWebView = MockWebView(); - final MockWebSettings mockWebSettings = MockWebSettings(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - mockSettings: mockWebSettings, - ); - - await controller.loadFile('/path/to/file.html'); - - verify(mockWebSettings.setAllowFileAccess(true)).called(1); - verify(mockWebView.loadUrl( - 'file:///path/to/file.html', - {}, - )).called(1); - }); - - test('loadFile without file prefix and characters to be escaped', () async { - final MockWebView mockWebView = MockWebView(); - final MockWebSettings mockWebSettings = MockWebSettings(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - mockSettings: mockWebSettings, - ); - - await controller.loadFile('/path/to/?_<_>_.html'); - - verify(mockWebSettings.setAllowFileAccess(true)).called(1); - verify(mockWebView.loadUrl( - 'file:///path/to/%3F_%3C_%3E_.html', - {}, - )).called(1); - }); - - test('loadFile with file prefix', () async { - final MockWebView mockWebView = MockWebView(); - final MockWebSettings mockWebSettings = MockWebSettings(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - - when(mockWebView.settings).thenReturn(mockWebSettings); - - await controller.loadFile('file:///path/to/file.html'); - - verify(mockWebSettings.setAllowFileAccess(true)).called(1); - verify(mockWebView.loadUrl( - 'file:///path/to/file.html', - {}, - )).called(1); - }); - - test('loadFlutterAsset when asset does not exist', () async { - final MockWebView mockWebView = MockWebView(); - final MockFlutterAssetManager mockAssetManager = - MockFlutterAssetManager(); - final AndroidWebViewController controller = createControllerWithMocks( - mockFlutterAssetManager: mockAssetManager, - mockWebView: mockWebView, - ); - - when(mockAssetManager.getAssetFilePathByName('mock_key')) - .thenAnswer((_) => Future.value('')); - when(mockAssetManager.list('')) - .thenAnswer((_) => Future>.value([])); - - try { - await controller.loadFlutterAsset('mock_key'); - fail('Expected an `ArgumentError`.'); - } on ArgumentError catch (e) { - expect(e.message, 'Asset for key "mock_key" not found.'); - expect(e.name, 'key'); - } on Error { - fail('Expect an `ArgumentError`.'); - } - - verify(mockAssetManager.getAssetFilePathByName('mock_key')).called(1); - verify(mockAssetManager.list('')).called(1); - verifyNever(mockWebView.loadUrl(any, any)); - }); - - test('loadFlutterAsset when asset does exists', () async { - final MockWebView mockWebView = MockWebView(); - final MockFlutterAssetManager mockAssetManager = - MockFlutterAssetManager(); - final AndroidWebViewController controller = createControllerWithMocks( - mockFlutterAssetManager: mockAssetManager, - mockWebView: mockWebView, - ); - - when(mockAssetManager.getAssetFilePathByName('mock_key')) - .thenAnswer((_) => Future.value('www/mock_file.html')); - when(mockAssetManager.list('www')).thenAnswer( - (_) => Future>.value(['mock_file.html'])); - - await controller.loadFlutterAsset('mock_key'); - - verify(mockAssetManager.getAssetFilePathByName('mock_key')).called(1); - verify(mockAssetManager.list('www')).called(1); - verify(mockWebView.loadUrl( - 'file:///android_asset/www/mock_file.html', {})); - }); - - test( - 'loadFlutterAsset when asset name contains characters that should be escaped', - () async { - final MockWebView mockWebView = MockWebView(); - final MockFlutterAssetManager mockAssetManager = - MockFlutterAssetManager(); - final AndroidWebViewController controller = createControllerWithMocks( - mockFlutterAssetManager: mockAssetManager, - mockWebView: mockWebView, - ); - - when(mockAssetManager.getAssetFilePathByName('mock_key')) - .thenAnswer((_) => Future.value('www/?_<_>_.html')); - when(mockAssetManager.list('www')).thenAnswer( - (_) => Future>.value(['?_<_>_.html'])); - - await controller.loadFlutterAsset('mock_key'); - - verify(mockAssetManager.getAssetFilePathByName('mock_key')).called(1); - verify(mockAssetManager.list('www')).called(1); - verify(mockWebView.loadUrl( - 'file:///android_asset/www/%3F_%3C_%3E_.html', {})); - }); - - test('loadHtmlString without baseUrl', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - - await controller.loadHtmlString('

Hello Test!

'); - - verify(mockWebView.loadDataWithBaseUrl( - data: '

Hello Test!

', - mimeType: 'text/html', - )).called(1); - }); - - test('loadHtmlString with baseUrl', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - - await controller.loadHtmlString('

Hello Test!

', - baseUrl: 'https://flutter.dev'); - - verify(mockWebView.loadDataWithBaseUrl( - data: '

Hello Test!

', - baseUrl: 'https://flutter.dev', - mimeType: 'text/html', - )).called(1); - }); - - test('loadRequest without URI scheme', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - final LoadRequestParams requestParams = LoadRequestParams( - uri: Uri.parse('flutter.dev'), - ); - - try { - await controller.loadRequest(requestParams); - fail('Expect an `ArgumentError`.'); - } on ArgumentError catch (e) { - expect(e.message, 'WebViewRequest#uri is required to have a scheme.'); - } on Error { - fail('Expect a `ArgumentError`.'); - } - - verifyNever(mockWebView.loadUrl(any, any)); - verifyNever(mockWebView.postUrl(any, any)); - }); - - test('loadRequest using the GET method', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - final LoadRequestParams requestParams = LoadRequestParams( - uri: Uri.parse('https://flutter.dev'), - headers: const {'X-Test': 'Testing'}, - ); - - await controller.loadRequest(requestParams); - - verify(mockWebView.loadUrl( - 'https://flutter.dev', - {'X-Test': 'Testing'}, - )); - verifyNever(mockWebView.postUrl(any, any)); - }); - - test('loadRequest using the POST method without body', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - final LoadRequestParams requestParams = LoadRequestParams( - uri: Uri.parse('https://flutter.dev'), - method: LoadRequestMethod.post, - headers: const {'X-Test': 'Testing'}, - ); - - await controller.loadRequest(requestParams); - - verify(mockWebView.postUrl( - 'https://flutter.dev', - Uint8List(0), - )); - verifyNever(mockWebView.loadUrl(any, any)); - }); - - test('loadRequest using the POST method with body', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - final LoadRequestParams requestParams = LoadRequestParams( - uri: Uri.parse('https://flutter.dev'), - method: LoadRequestMethod.post, - headers: const {'X-Test': 'Testing'}, - body: Uint8List.fromList('{"message": "Hello World!"}'.codeUnits), - ); - - await controller.loadRequest(requestParams); - - verify(mockWebView.postUrl( - 'https://flutter.dev', - Uint8List.fromList('{"message": "Hello World!"}'.codeUnits), - )); - verifyNever(mockWebView.loadUrl(any, any)); - }); - - test('currentUrl', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - - await controller.currentUrl(); - - verify(mockWebView.getUrl()).called(1); - }); - - test('canGoBack', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - - await controller.canGoBack(); - - verify(mockWebView.canGoBack()).called(1); - }); - - test('canGoForward', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - - await controller.canGoForward(); - - verify(mockWebView.canGoForward()).called(1); - }); - - test('goBack', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - - await controller.goBack(); - - verify(mockWebView.goBack()).called(1); - }); - - test('goForward', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - - await controller.goForward(); - - verify(mockWebView.goForward()).called(1); - }); - - test('reload', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - - await controller.reload(); - - verify(mockWebView.reload()).called(1); - }); - - test('clearCache', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - - await controller.clearCache(); - - verify(mockWebView.clearCache(true)).called(1); - }); - - test('clearLocalStorage', () async { - final MockWebStorage mockWebStorage = MockWebStorage(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebStorage: mockWebStorage, - ); - - await controller.clearLocalStorage(); - - verify(mockWebStorage.deleteAllData()).called(1); - }); - - test('setPlatformNavigationDelegate', () async { - final MockAndroidNavigationDelegate mockNavigationDelegate = - MockAndroidNavigationDelegate(); - final MockWebView mockWebView = MockWebView(); - final MockWebChromeClient mockWebChromeClient = MockWebChromeClient(); - final MockWebViewClient mockWebViewClient = MockWebViewClient(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - - when(mockNavigationDelegate.androidWebChromeClient) - .thenReturn(mockWebChromeClient); - when(mockNavigationDelegate.androidWebViewClient) - .thenReturn(mockWebViewClient); - - await controller.setPlatformNavigationDelegate(mockNavigationDelegate); - - verify(mockWebView.setWebViewClient(mockWebViewClient)); - verifyNever(mockWebView.setWebChromeClient(mockWebChromeClient)); - }); - - test('onProgress', () { - final AndroidNavigationDelegate androidNavigationDelegate = - AndroidNavigationDelegate( - AndroidNavigationDelegateCreationParams - .fromPlatformNavigationDelegateCreationParams( - const PlatformNavigationDelegateCreationParams(), - androidWebViewProxy: const AndroidWebViewProxy( - createAndroidWebViewClient: android_webview.WebViewClient.detached, - createAndroidWebChromeClient: - android_webview.WebChromeClient.detached, - createDownloadListener: android_webview.DownloadListener.detached, - ), - ), - ); - - late final int callbackProgress; - androidNavigationDelegate - .setOnProgress((int progress) => callbackProgress = progress); - - final AndroidWebViewController controller = createControllerWithMocks( - createWebChromeClient: CapturingWebChromeClient.new, - ); - controller.setPlatformNavigationDelegate(androidNavigationDelegate); - - CapturingWebChromeClient.lastCreatedDelegate.onProgressChanged!( - android_webview.WebView.detached(), - 42, - ); - - expect(callbackProgress, 42); - }); - - test('onProgress does not cause LateInitializationError', () { - // ignore: unused_local_variable - final AndroidWebViewController controller = createControllerWithMocks( - createWebChromeClient: CapturingWebChromeClient.new, - ); - - // Should not cause LateInitializationError - CapturingWebChromeClient.lastCreatedDelegate.onProgressChanged!( - android_webview.WebView.detached(), - 42, - ); - }); - - test('setOnShowFileSelector', () async { - late final Future> Function( - android_webview.WebView webView, - android_webview.FileChooserParams params, - ) onShowFileChooserCallback; - final MockWebChromeClient mockWebChromeClient = MockWebChromeClient(); - final AndroidWebViewController controller = createControllerWithMocks( - createWebChromeClient: ({ - dynamic onProgressChanged, - Future> Function( - android_webview.WebView webView, - android_webview.FileChooserParams params, - )? onShowFileChooser, - dynamic onGeolocationPermissionsShowPrompt, - dynamic onGeolocationPermissionsHidePrompt, - dynamic onPermissionRequest, - dynamic onShowCustomView, - dynamic onHideCustomView, - }) { - onShowFileChooserCallback = onShowFileChooser!; - return mockWebChromeClient; - }, - ); - - late final FileSelectorParams fileSelectorParams; - await controller.setOnShowFileSelector( - (FileSelectorParams params) async { - fileSelectorParams = params; - return []; - }, - ); - - verify( - mockWebChromeClient.setSynchronousReturnValueForOnShowFileChooser(true), - ); - - onShowFileChooserCallback( - android_webview.WebView.detached(), - android_webview.FileChooserParams.detached( - isCaptureEnabled: false, - acceptTypes: const ['png'], - filenameHint: 'filenameHint', - mode: android_webview.FileChooserMode.open, - ), - ); - - expect(fileSelectorParams.isCaptureEnabled, isFalse); - expect(fileSelectorParams.acceptTypes, ['png']); - expect(fileSelectorParams.filenameHint, 'filenameHint'); - expect(fileSelectorParams.mode, FileSelectorMode.open); - }); - - test('setGeolocationPermissionsPromptCallbacks', () async { - final MockTestGeolocationPermissionsCallbackHostApi mockApi = - MockTestGeolocationPermissionsCallbackHostApi(); - TestGeolocationPermissionsCallbackHostApi.setup(mockApi); - - final InstanceManager instanceManager = InstanceManager( - onWeakReferenceRemoved: (_) {}, - ); - - final android_webview.GeolocationPermissionsCallback testCallback = - android_webview.GeolocationPermissionsCallback.detached( - instanceManager: instanceManager, - ); - - const int instanceIdentifier = 0; - instanceManager.addHostCreatedInstance(testCallback, instanceIdentifier); - - late final Future Function(String origin, - android_webview.GeolocationPermissionsCallback callback) - onGeoPermissionHandle; - late final void Function(android_webview.WebChromeClient instance) - onGeoPermissionHidePromptHandle; - - final MockWebChromeClient mockWebChromeClient = MockWebChromeClient(); - final AndroidWebViewController controller = createControllerWithMocks( - createWebChromeClient: ({ - dynamic onProgressChanged, - dynamic onShowFileChooser, - Future Function(String origin, - android_webview.GeolocationPermissionsCallback callback)? - onGeolocationPermissionsShowPrompt, - void Function(android_webview.WebChromeClient instance)? - onGeolocationPermissionsHidePrompt, - dynamic onPermissionRequest, - dynamic onShowCustomView, - dynamic onHideCustomView, - }) { - onGeoPermissionHandle = onGeolocationPermissionsShowPrompt!; - onGeoPermissionHidePromptHandle = onGeolocationPermissionsHidePrompt!; - return mockWebChromeClient; - }, - ); - - String testValue = 'origin'; - const String allowOrigin = 'https://www.allow.com'; - bool isAllow = false; - - late final GeolocationPermissionsResponse response; - controller.setGeolocationPermissionsPromptCallbacks( - onShowPrompt: (GeolocationPermissionsRequestParams request) async { - isAllow = request.origin == allowOrigin; - response = - GeolocationPermissionsResponse(allow: isAllow, retain: isAllow); - return response; - }, - onHidePrompt: () { - testValue = 'changed'; - }, - ); - - await onGeoPermissionHandle( - allowOrigin, - testCallback, - ); - - expect(isAllow, true); - - onGeoPermissionHidePromptHandle(mockWebChromeClient); - expect(testValue, 'changed'); - }); - - test('setCustomViewCallbacks', () async { - final MockTestCustomViewCallbackHostApi mockApi = - MockTestCustomViewCallbackHostApi(); - TestCustomViewCallbackHostApi.setup(mockApi); - - final InstanceManager instanceManager = InstanceManager( - onWeakReferenceRemoved: (_) {}, - ); - - final android_webview.CustomViewCallback testCallback = - android_webview.CustomViewCallback.detached( - instanceManager: instanceManager, - ); - - const int instanceIdentifier = 0; - instanceManager.addHostCreatedInstance(testCallback, instanceIdentifier); - - late final void Function( - android_webview.WebChromeClient instance, - android_webview.View view, - android_webview.CustomViewCallback callback) onShowCustomViewHandle; - late final void Function(android_webview.WebChromeClient instance) - onHideCustomViewHandle; - - final MockWebChromeClient mockWebChromeClient = MockWebChromeClient(); - final AndroidWebViewController controller = createControllerWithMocks( - createWebChromeClient: ({ - dynamic onProgressChanged, - dynamic onShowFileChooser, - dynamic onGeolocationPermissionsShowPrompt, - dynamic onGeolocationPermissionsHidePrompt, - dynamic onPermissionRequest, - void Function( - android_webview.WebChromeClient instance, - android_webview.View view, - android_webview.CustomViewCallback callback)? - onShowCustomView, - void Function(android_webview.WebChromeClient instance)? - onHideCustomView, - }) { - onShowCustomViewHandle = onShowCustomView!; - onHideCustomViewHandle = onHideCustomView!; - return mockWebChromeClient; - }, - ); - - final android_webview.View testView = android_webview.View.detached(); - bool showCustomViewCalled = false; - bool hideCustomViewCalled = false; - - controller.setCustomViewCallbacks( - onShowCustomView: (AndroidCustomViewWidget widget, - OnHideCustomViewCallback callback) async { - showCustomViewCalled = true; - }, - onHideCustomView: () { - hideCustomViewCalled = true; - }, - ); - - onShowCustomViewHandle( - mockWebChromeClient, - testView, - android_webview.CustomViewCallback.detached(), - ); - - expect(showCustomViewCalled, true); - - onHideCustomViewHandle(mockWebChromeClient); - expect(hideCustomViewCalled, true); - }); - - test('setOnPlatformPermissionRequest', () async { - late final void Function( - android_webview.WebChromeClient instance, - android_webview.PermissionRequest request, - ) onPermissionRequestCallback; - - final MockWebChromeClient mockWebChromeClient = MockWebChromeClient(); - final AndroidWebViewController controller = createControllerWithMocks( - createWebChromeClient: ({ - dynamic onProgressChanged, - dynamic onShowFileChooser, - dynamic onGeolocationPermissionsShowPrompt, - dynamic onGeolocationPermissionsHidePrompt, - void Function( - android_webview.WebChromeClient instance, - android_webview.PermissionRequest request, - )? onPermissionRequest, - dynamic onShowCustomView, - dynamic onHideCustomView, - }) { - onPermissionRequestCallback = onPermissionRequest!; - return mockWebChromeClient; - }, - ); - - late final PlatformWebViewPermissionRequest permissionRequest; - await controller.setOnPlatformPermissionRequest( - (PlatformWebViewPermissionRequest request) async { - permissionRequest = request; - request.grant(); - }, - ); - - final List permissionTypes = [ - android_webview.PermissionRequest.audioCapture, - ]; - - final MockPermissionRequest mockPermissionRequest = - MockPermissionRequest(); - when(mockPermissionRequest.resources).thenReturn(permissionTypes); - - onPermissionRequestCallback( - android_webview.WebChromeClient.detached(), - mockPermissionRequest, - ); - - expect(permissionRequest.types, [ - WebViewPermissionResourceType.microphone, - ]); - verify(mockPermissionRequest.grant(permissionTypes)); - }); - - test( - 'setOnPlatformPermissionRequest callback not invoked when type is not recognized', - () async { - late final void Function( - android_webview.WebChromeClient instance, - android_webview.PermissionRequest request, - ) onPermissionRequestCallback; - - final MockWebChromeClient mockWebChromeClient = MockWebChromeClient(); - final AndroidWebViewController controller = createControllerWithMocks( - createWebChromeClient: ({ - dynamic onProgressChanged, - dynamic onShowFileChooser, - dynamic onGeolocationPermissionsShowPrompt, - dynamic onGeolocationPermissionsHidePrompt, - void Function( - android_webview.WebChromeClient instance, - android_webview.PermissionRequest request, - )? onPermissionRequest, - dynamic onShowCustomView, - dynamic onHideCustomView, - }) { - onPermissionRequestCallback = onPermissionRequest!; - return mockWebChromeClient; - }, - ); - - bool callbackCalled = false; - await controller.setOnPlatformPermissionRequest( - (PlatformWebViewPermissionRequest request) async { - callbackCalled = true; - }, - ); - - final MockPermissionRequest mockPermissionRequest = - MockPermissionRequest(); - when(mockPermissionRequest.resources).thenReturn(['unknownType']); - - onPermissionRequestCallback( - android_webview.WebChromeClient.detached(), - mockPermissionRequest, - ); - - expect(callbackCalled, isFalse); - }); - - test('runJavaScript', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - - await controller.runJavaScript('alert("This is a test.");'); - - verify(mockWebView.evaluateJavascript('alert("This is a test.");')) - .called(1); - }); - - test('runJavaScriptReturningResult with return value', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - - when(mockWebView.evaluateJavascript('return "Hello" + " World!";')) - .thenAnswer((_) => Future.value('Hello World!')); - - final String message = await controller.runJavaScriptReturningResult( - 'return "Hello" + " World!";') as String; - - expect(message, 'Hello World!'); - }); - - test('runJavaScriptReturningResult returning null', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - - when(mockWebView.evaluateJavascript('alert("This is a test.");')) - .thenAnswer((_) => Future.value()); - - final String message = await controller - .runJavaScriptReturningResult('alert("This is a test.");') as String; - - expect(message, ''); - }); - - test('runJavaScriptReturningResult parses num', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - - when(mockWebView.evaluateJavascript('alert("This is a test.");')) - .thenAnswer((_) => Future.value('3.14')); - - final num message = await controller - .runJavaScriptReturningResult('alert("This is a test.");') as num; - - expect(message, 3.14); - }); - - test('runJavaScriptReturningResult parses true', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - - when(mockWebView.evaluateJavascript('alert("This is a test.");')) - .thenAnswer((_) => Future.value('true')); - - final bool message = await controller - .runJavaScriptReturningResult('alert("This is a test.");') as bool; - - expect(message, true); - }); - - test('runJavaScriptReturningResult parses false', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - - when(mockWebView.evaluateJavascript('alert("This is a test.");')) - .thenAnswer((_) => Future.value('false')); - - final bool message = await controller - .runJavaScriptReturningResult('alert("This is a test.");') as bool; - - expect(message, false); - }); - - test('addJavaScriptChannel', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - final AndroidJavaScriptChannelParams paramsWithMock = - createAndroidJavaScriptChannelParamsWithMocks(name: 'test'); - await controller.addJavaScriptChannel(paramsWithMock); - verify(mockWebView.addJavaScriptChannel( - argThat(isA()))) - .called(1); - }); - - test( - 'addJavaScriptChannel add channel with same name should remove existing channel', - () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - final AndroidJavaScriptChannelParams paramsWithMock = - createAndroidJavaScriptChannelParamsWithMocks(name: 'test'); - await controller.addJavaScriptChannel(paramsWithMock); - verify(mockWebView.addJavaScriptChannel( - argThat(isA()))) - .called(1); - - await controller.addJavaScriptChannel(paramsWithMock); - verifyInOrder([ - mockWebView.removeJavaScriptChannel( - argThat(isA())), - mockWebView.addJavaScriptChannel( - argThat(isA())), - ]); - }); - - test('removeJavaScriptChannel when channel is not registered', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - - await controller.removeJavaScriptChannel('test'); - verifyNever(mockWebView.removeJavaScriptChannel(any)); - }); - - test('removeJavaScriptChannel when channel exists', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - final AndroidJavaScriptChannelParams paramsWithMock = - createAndroidJavaScriptChannelParamsWithMocks(name: 'test'); - - // Make sure channel exists before removing it. - await controller.addJavaScriptChannel(paramsWithMock); - verify(mockWebView.addJavaScriptChannel( - argThat(isA()))) - .called(1); - - await controller.removeJavaScriptChannel('test'); - verify(mockWebView.removeJavaScriptChannel( - argThat(isA()))) - .called(1); - }); - - test('getTitle', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - - await controller.getTitle(); - - verify(mockWebView.getTitle()).called(1); - }); - - test('scrollTo', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - - await controller.scrollTo(4, 2); - - verify(mockWebView.scrollTo(4, 2)).called(1); - }); - - test('scrollBy', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - - await controller.scrollBy(4, 2); - - verify(mockWebView.scrollBy(4, 2)).called(1); - }); - - test('getScrollPosition', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - when(mockWebView.getScrollPosition()) - .thenAnswer((_) => Future.value(const Offset(4, 2))); - - final Offset position = await controller.getScrollPosition(); - - verify(mockWebView.getScrollPosition()).called(1); - expect(position.dx, 4); - expect(position.dy, 2); - }); - - test('enableDebugging', () async { - final MockAndroidWebViewProxy mockProxy = MockAndroidWebViewProxy(); - - await AndroidWebViewController.enableDebugging( - true, - webViewProxy: mockProxy, - ); - verify(mockProxy.setWebContentsDebuggingEnabled(true)).called(1); - }); - - test('enableZoom', () async { - final MockWebView mockWebView = MockWebView(); - final MockWebSettings mockSettings = MockWebSettings(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - mockSettings: mockSettings, - ); - - clearInteractions(mockWebView); - - await controller.enableZoom(true); - - verify(mockWebView.settings).called(1); - verify(mockSettings.setSupportZoom(true)).called(1); - }); - - test('setBackgroundColor', () async { - final MockWebView mockWebView = MockWebView(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - - await controller.setBackgroundColor(Colors.blue); - - verify(mockWebView.setBackgroundColor(Colors.blue)).called(1); - }); - - test('setJavaScriptMode', () async { - final MockWebView mockWebView = MockWebView(); - final MockWebSettings mockSettings = MockWebSettings(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - mockSettings: mockSettings, - ); - - clearInteractions(mockWebView); - - await controller.setJavaScriptMode(JavaScriptMode.disabled); - - verify(mockWebView.settings).called(1); - verify(mockSettings.setJavaScriptEnabled(false)).called(1); - }); - - test('setUserAgent', () async { - final MockWebView mockWebView = MockWebView(); - final MockWebSettings mockSettings = MockWebSettings(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - mockSettings: mockSettings, - ); - - clearInteractions(mockWebView); - - await controller.setUserAgent('Test Framework'); - - verify(mockWebView.settings).called(1); - verify(mockSettings.setUserAgentString('Test Framework')).called(1); - }); - }); - - test('setMediaPlaybackRequiresUserGesture', () async { - final MockWebView mockWebView = MockWebView(); - final MockWebSettings mockSettings = MockWebSettings(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - mockSettings: mockSettings, - ); - - await controller.setMediaPlaybackRequiresUserGesture(true); - - verify(mockSettings.setMediaPlaybackRequiresUserGesture(true)).called(1); - }); - - test('setTextZoom', () async { - final MockWebView mockWebView = MockWebView(); - final MockWebSettings mockSettings = MockWebSettings(); - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - mockSettings: mockSettings, - ); - - clearInteractions(mockWebView); - - await controller.setTextZoom(100); - - verify(mockWebView.settings).called(1); - verify(mockSettings.setTextZoom(100)).called(1); - }); - - test('webViewIdentifier', () { - final MockWebView mockWebView = MockWebView(); - final InstanceManager instanceManager = InstanceManager( - onWeakReferenceRemoved: (_) {}, - ); - instanceManager.addHostCreatedInstance(mockWebView, 0); - - android_webview.WebView.api = WebViewHostApiImpl( - instanceManager: instanceManager, - ); - - final AndroidWebViewController controller = createControllerWithMocks( - mockWebView: mockWebView, - ); - - expect( - controller.webViewIdentifier, - 0, - ); - - android_webview.WebView.api = WebViewHostApiImpl(); - }); - - group('AndroidWebViewWidget', () { - testWidgets('Builds Android view using supplied parameters', - (WidgetTester tester) async { - final AndroidWebViewController controller = createControllerWithMocks(); - - final AndroidWebViewWidget webViewWidget = AndroidWebViewWidget( - AndroidWebViewWidgetCreationParams( - key: const Key('test_web_view'), - controller: controller, - ), - ); - - await tester.pumpWidget(Builder( - builder: (BuildContext context) => webViewWidget.build(context), - )); - - expect(find.byType(PlatformViewLink), findsOneWidget); - expect(find.byKey(const Key('test_web_view')), findsOneWidget); - }); - - testWidgets('displayWithHybridComposition is false', - (WidgetTester tester) async { - final AndroidWebViewController controller = createControllerWithMocks(); - - final MockPlatformViewsServiceProxy mockPlatformViewsService = - MockPlatformViewsServiceProxy(); - - when( - mockPlatformViewsService.initSurfaceAndroidView( - id: anyNamed('id'), - viewType: anyNamed('viewType'), - layoutDirection: anyNamed('layoutDirection'), - creationParams: anyNamed('creationParams'), - creationParamsCodec: anyNamed('creationParamsCodec'), - onFocus: anyNamed('onFocus'), - ), - ).thenReturn(MockSurfaceAndroidViewController()); - - final AndroidWebViewWidget webViewWidget = AndroidWebViewWidget( - AndroidWebViewWidgetCreationParams( - key: const Key('test_web_view'), - controller: controller, - platformViewsServiceProxy: mockPlatformViewsService, - ), - ); - - await tester.pumpWidget(Builder( - builder: (BuildContext context) => webViewWidget.build(context), - )); - await tester.pumpAndSettle(); - - verify( - mockPlatformViewsService.initSurfaceAndroidView( - id: anyNamed('id'), - viewType: anyNamed('viewType'), - layoutDirection: anyNamed('layoutDirection'), - creationParams: anyNamed('creationParams'), - creationParamsCodec: anyNamed('creationParamsCodec'), - onFocus: anyNamed('onFocus'), - ), - ); - }); - - testWidgets('displayWithHybridComposition is true', - (WidgetTester tester) async { - final AndroidWebViewController controller = createControllerWithMocks(); - - final MockPlatformViewsServiceProxy mockPlatformViewsService = - MockPlatformViewsServiceProxy(); - - when( - mockPlatformViewsService.initExpensiveAndroidView( - id: anyNamed('id'), - viewType: anyNamed('viewType'), - layoutDirection: anyNamed('layoutDirection'), - creationParams: anyNamed('creationParams'), - creationParamsCodec: anyNamed('creationParamsCodec'), - onFocus: anyNamed('onFocus'), - ), - ).thenReturn(MockExpensiveAndroidViewController()); - - final AndroidWebViewWidget webViewWidget = AndroidWebViewWidget( - AndroidWebViewWidgetCreationParams( - key: const Key('test_web_view'), - controller: controller, - platformViewsServiceProxy: mockPlatformViewsService, - displayWithHybridComposition: true, - ), - ); - - await tester.pumpWidget(Builder( - builder: (BuildContext context) => webViewWidget.build(context), - )); - await tester.pumpAndSettle(); - - verify( - mockPlatformViewsService.initExpensiveAndroidView( - id: anyNamed('id'), - viewType: anyNamed('viewType'), - layoutDirection: anyNamed('layoutDirection'), - creationParams: anyNamed('creationParams'), - creationParamsCodec: anyNamed('creationParamsCodec'), - onFocus: anyNamed('onFocus'), - ), - ); - }); - }); - - group('AndroidCustomViewWidget', () { - testWidgets('Builds Android custom view using supplied parameters', - (WidgetTester tester) async { - final AndroidWebViewController controller = createControllerWithMocks(); - - final AndroidCustomViewWidget customViewWidget = - AndroidCustomViewWidget.private( - key: const Key('test_custom_view'), - creationParams: AndroidCustomViewWidgetCreationParams( - customView: android_webview.View.detached(), - controller: controller, - ), - ); - - await tester.pumpWidget(Builder( - builder: (BuildContext context) => customViewWidget.build(context), - )); - - expect(find.byType(PlatformViewLink), findsOneWidget); - expect(find.byKey(const Key('test_custom_view')), findsOneWidget); - }); - - testWidgets('displayWithHybridComposition is false', - (WidgetTester tester) async { - final AndroidWebViewController controller = createControllerWithMocks(); - - final MockPlatformViewsServiceProxy mockPlatformViewsService = - MockPlatformViewsServiceProxy(); - - when( - mockPlatformViewsService.initSurfaceAndroidView( - id: anyNamed('id'), - viewType: anyNamed('viewType'), - layoutDirection: anyNamed('layoutDirection'), - creationParams: anyNamed('creationParams'), - creationParamsCodec: anyNamed('creationParamsCodec'), - onFocus: anyNamed('onFocus'), - ), - ).thenReturn(MockSurfaceAndroidViewController()); - - final AndroidCustomViewWidget customViewWidget = - AndroidCustomViewWidget.private( - creationParams: AndroidCustomViewWidgetCreationParams( - controller: controller, - customView: android_webview.View.detached(), - platformViewsServiceProxy: mockPlatformViewsService, - ), - ); - - await tester.pumpWidget(Builder( - builder: (BuildContext context) => customViewWidget.build(context), - )); - await tester.pumpAndSettle(); - - verify( - mockPlatformViewsService.initSurfaceAndroidView( - id: anyNamed('id'), - viewType: anyNamed('viewType'), - layoutDirection: anyNamed('layoutDirection'), - creationParams: anyNamed('creationParams'), - creationParamsCodec: anyNamed('creationParamsCodec'), - onFocus: anyNamed('onFocus'), - ), - ); - }); - - testWidgets('displayWithHybridComposition is true', - (WidgetTester tester) async { - final AndroidWebViewController controller = createControllerWithMocks(); - - final MockPlatformViewsServiceProxy mockPlatformViewsService = - MockPlatformViewsServiceProxy(); - - when( - mockPlatformViewsService.initExpensiveAndroidView( - id: anyNamed('id'), - viewType: anyNamed('viewType'), - layoutDirection: anyNamed('layoutDirection'), - creationParams: anyNamed('creationParams'), - creationParamsCodec: anyNamed('creationParamsCodec'), - onFocus: anyNamed('onFocus'), - ), - ).thenReturn(MockExpensiveAndroidViewController()); - - final AndroidCustomViewWidget webViewWidget = - AndroidCustomViewWidget.private( - creationParams: AndroidCustomViewWidgetCreationParams( - controller: controller, - customView: android_webview.View.detached(), - platformViewsServiceProxy: mockPlatformViewsService, - displayWithHybridComposition: true, - ), - ); - - await tester.pumpWidget(Builder( - builder: (BuildContext context) => webViewWidget.build(context), - )); - await tester.pumpAndSettle(); - - verify( - mockPlatformViewsService.initExpensiveAndroidView( - id: anyNamed('id'), - viewType: anyNamed('viewType'), - layoutDirection: anyNamed('layoutDirection'), - creationParams: anyNamed('creationParams'), - creationParamsCodec: anyNamed('creationParamsCodec'), - onFocus: anyNamed('onFocus'), - ), - ); - }); - }); -} From 6347f988f59d2aabd977e8d7ed5d62948f5fc116 Mon Sep 17 00:00:00 2001 From: Maurits van Beusekom Date: Fri, 11 Aug 2023 22:04:55 +0200 Subject: [PATCH 25/35] Fixed analysis warning --- .../integration_test/webview_flutter_test.dart | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart index 95cbbebb3847..04b9b7f83eba 100644 --- a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart @@ -388,19 +388,12 @@ Future main() async { return video.webkitDisplayingFullscreen; } function toggleFullScreen() { - LogChannel.postMessage("JavaScript: Running onClick"); let elem = document.getElementById("video"); if (!document.fullscreenElement) { - LogChannel.postMessage("JavaScript: Showing fullscreen"); - elem.requestFullscreen().catch((err) => { - LogChannel.postMessage("JavaScript: Error attempting to enable fullscreen mode: " + err.message + " (" + err.name + ")",); - }); - LogChannel.postMessage("JavaScript: Shown fullscreen"); + elem.requestFullscreen(); } else { - LogChannel.postMessage("JavaScript: Closing fullscreen"); document.exitFullscreen(); - LogChannel.postMessage("JavaScript: Closed fullscreen"); } } @@ -565,15 +558,6 @@ Future main() async { onHideCustomView!(); })); - unawaited(controller.addJavaScriptChannel( - JavaScriptChannelParams( - name: 'LogChannel', - onMessageReceived: (JavaScriptMessage message) { - print(message.message); - }, - ), - )); - await controller.loadRequest( LoadRequestParams( uri: Uri.parse( From b319604a16b85d4dcd6151d4942abdafada8d949 Mon Sep 17 00:00:00 2001 From: Maurits van Beusekom Date: Mon, 14 Aug 2023 10:02:08 +0200 Subject: [PATCH 26/35] Formatted JAVA files --- .../flutter/plugins/webviewflutter/WebViewFlutterPlugin.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java index 7eb80c30dadd..e763c919e021 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterPlugin.java @@ -143,8 +143,7 @@ private void setUp( binaryMessenger, new GeolocationPermissionsCallbackHostApiImpl(binaryMessenger, instanceManager)); CustomViewCallbackHostApi.setup( - binaryMessenger, - new CustomViewCallbackHostApiImpl(binaryMessenger, instanceManager)); + binaryMessenger, new CustomViewCallbackHostApiImpl(binaryMessenger, instanceManager)); } @Override From 3e39dd287242916b1a97909220de66b56f6543d2 Mon Sep 17 00:00:00 2001 From: Maurits van Beusekom Date: Thu, 17 Aug 2023 20:01:12 +0200 Subject: [PATCH 27/35] Explain the tapAt statement in integration test --- .../example/integration_test/webview_flutter_test.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart index 04b9b7f83eba..38d32110e6fc 100644 --- a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart @@ -581,6 +581,13 @@ Future main() async { await tester.pumpAndSettle(); + // Due to security reasons, Chrome doesn't allow to programmatically + // toggle a video to fullscreen unless the call is directly comming from + // a user triggered event. + // The top half of the loaded web content contains a clickable div, which + // is tapped using the code below, triggering a user event. + // + //The offset of 20 x 20 is choossen at random. await tester.tapAt(const Offset(20, 20)); await expectLater(fullscreenEntered.future, completes); From 3e7454098b85fed1f2d8232260c2bf7f578c5bfe Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 17 Aug 2023 20:13:44 -0400 Subject: [PATCH 28/35] Update packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart --- .../example/integration_test/webview_flutter_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart index 38d32110e6fc..900f635f2469 100644 --- a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart @@ -587,7 +587,7 @@ Future main() async { // The top half of the loaded web content contains a clickable div, which // is tapped using the code below, triggering a user event. // - //The offset of 20 x 20 is choossen at random. + // The offset of 20 x 20 is chosen at random. await tester.tapAt(const Offset(20, 20)); await expectLater(fullscreenEntered.future, completes); From 289cccdffbe36668164dccdeb76295352472435c Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 18 Aug 2023 17:05:40 -0400 Subject: [PATCH 29/35] update dartdocs and changelog --- .../webview_flutter/webview_flutter_android/CHANGELOG.md | 3 ++- .../lib/src/android_webview_controller.dart | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md index d1198b132130..6acabb860ee0 100644 --- a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md @@ -1,6 +1,7 @@ ## 3.10.0 -* Adds support for playing video in fullscreen. +* Adds support for playing video in fullscreen. See + `AndroidWebViewController.setCustomWidgetCallbacks`. ## 3.9.3 diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart index 15963743f459..fa2960ce2c05 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart @@ -538,18 +538,19 @@ class AndroidWebViewController extends PlatformWebViewController { } /// Sets the callbacks that are invoked when the host application wants to - /// show or hide a custom view. + /// show or hide a custom widget. /// /// The most common use case these methods are invoked a video element wants /// to be displayed in fullscreen. /// /// The [onShowCustomWidget] notifies the host application that web content - /// from the specified origin wants to be displayed in a custom view. After - /// this call, web content will no longer be rendered in the WebViewWidget, + /// from the specified origin wants to be displayed in a custom widget. After + /// this call, web content will no longer be rendered in the `WebViewWidget`, /// but will instead be rendered in the custom widget. /// /// The [onHideCustomWidget] notifies the host application that the custom - /// view should be hidden. + /// widget must be hidden. After this call, web content will render in the + /// original `WebViewWidget` again. Future setCustomWidgetCallbacks({ OnShowCustomWidgetCallback? onShowCustomWidget, OnHideCustomWidgetCallback? onHideCustomWidget, From 5d45ea0a57deddfcc948e905fada4aa25054b0b8 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 18 Aug 2023 17:59:26 -0400 Subject: [PATCH 30/35] provide example for fullscreen --- .../webview_flutter_android/README.md | 23 ++++++++++++++++++- .../example/lib/main.dart | 2 ++ .../lib/src/android_webview_controller.dart | 8 ++++++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/README.md b/packages/webview_flutter/webview_flutter_android/README.md index 06ec1a7bad49..1db03b3afdda 100644 --- a/packages/webview_flutter/webview_flutter_android/README.md +++ b/packages/webview_flutter/webview_flutter_android/README.md @@ -36,7 +36,7 @@ This can be configured for versions >=23 with `AndroidWebViewWidgetCreationParams.displayWithHybridComposition`. See https://pub.dev/packages/webview_flutter#platform-specific-features for more details on setting platform-specific features in the main plugin. -### External Native API +## External Native API The plugin also provides a native API accessible by the native code of Android applications or packages. This API follows the convention of breaking changes of the Dart API, which means that any @@ -52,6 +52,27 @@ Java: import io.flutter.plugins.webviewflutter.WebViewFlutterAndroidExternalApi; ``` +## Fullscreen Video + +To display a video as fullscreen, an app must manually handle the notification that the current page +has entered fullscreen mode. This can be done by calling +`AndroidWebViewController.setCustomWidgetCallbacks`. Below is an example implementation. + + +```dart +androidController.setCustomWidgetCallbacks( + onShowCustomWidget: (Widget widget, OnHideCustomWidgetCallback callback) { + Navigator.of(context).push(MaterialPageRoute( + builder: (BuildContext context) => widget, + fullscreenDialog: true, + )); + }, + onHideCustomWidget: () { + Navigator.of(context).pop(); + }, +); +``` + ## Contributing This package uses [pigeon][3] to generate the communication layer between Flutter and the host diff --git a/packages/webview_flutter/webview_flutter_android/example/lib/main.dart b/packages/webview_flutter/webview_flutter_android/example/lib/main.dart index 1b11b9978174..781a98f87f7b 100644 --- a/packages/webview_flutter/webview_flutter_android/example/lib/main.dart +++ b/packages/webview_flutter/webview_flutter_android/example/lib/main.dart @@ -423,6 +423,7 @@ class SampleMenu extends StatelessWidget { Future _onVideoExample(BuildContext context) { final AndroidWebViewController androidController = webViewController as AndroidWebViewController; + // #docregion fullscreen_example androidController.setCustomWidgetCallbacks( onShowCustomWidget: (Widget widget, OnHideCustomWidgetCallback callback) { Navigator.of(context).push(MaterialPageRoute( @@ -434,6 +435,7 @@ class SampleMenu extends StatelessWidget { Navigator.of(context).pop(); }, ); + // #enddocregion fullscreen_example return androidController.loadRequest( LoadRequestParams( diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart index fa2960ce2c05..9dc08664daa8 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart @@ -546,7 +546,13 @@ class AndroidWebViewController extends PlatformWebViewController { /// The [onShowCustomWidget] notifies the host application that web content /// from the specified origin wants to be displayed in a custom widget. After /// this call, web content will no longer be rendered in the `WebViewWidget`, - /// but will instead be rendered in the custom widget. + /// but will instead be rendered in the custom widget. The application may + /// explicitly exit fullscreen mode by invoking `onCustomWidgetHidden` in the + /// [onShowCustomWidget] callback (ex. when the user presses the back + /// button). However, this is generally not necessary as the web page will + /// often show its own UI to close out of fullscreen. Regardless of how the + /// WebView exits fullscreen mode, WebView will invoke [onHideCustomWidget], + /// signaling for the application to remove the custom widget. /// /// The [onHideCustomWidget] notifies the host application that the custom /// widget must be hidden. After this call, web content will render in the From 6ca8d15436e88b62f3ee9ed97b5194c19e806a4c Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 18 Aug 2023 18:06:54 -0400 Subject: [PATCH 31/35] require callbacks --- .../lib/src/android_webview_controller.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart index 9dc08664daa8..4ca3f049a2b9 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart @@ -558,8 +558,8 @@ class AndroidWebViewController extends PlatformWebViewController { /// widget must be hidden. After this call, web content will render in the /// original `WebViewWidget` again. Future setCustomWidgetCallbacks({ - OnShowCustomWidgetCallback? onShowCustomWidget, - OnHideCustomWidgetCallback? onHideCustomWidget, + required OnShowCustomWidgetCallback? onShowCustomWidget, + required OnHideCustomWidgetCallback? onHideCustomWidget, }) async { _onShowCustomWidgetCallback = onShowCustomWidget; _onHideCustomWidgetCallback = onHideCustomWidget; From 0b7361aeb0e442d35d486d264db66ff27beaeeba Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Mon, 21 Aug 2023 16:20:07 -0400 Subject: [PATCH 32/35] formatting --- .../example/integration_test/webview_flutter_test.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart index 900f635f2469..23388dd7daa8 100644 --- a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart @@ -581,11 +581,11 @@ Future main() async { await tester.pumpAndSettle(); - // Due to security reasons, Chrome doesn't allow to programmatically - // toggle a video to fullscreen unless the call is directly comming from + // Due to security reasons, Chrome doesn't allow to programmatically + // toggle a video to fullscreen unless the call is directly comming from // a user triggered event. // The top half of the loaded web content contains a clickable div, which - // is tapped using the code below, triggering a user event. + // is tapped using the code below, triggering a user event. // // The offset of 20 x 20 is chosen at random. await tester.tapAt(const Offset(20, 20)); From 45720e4b14d289ee85d50448ca1f81dc250d66f7 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 25 Aug 2023 16:22:13 -0400 Subject: [PATCH 33/35] add a default handler --- .../lib/src/android_webview_controller.dart | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart index 4ca3f049a2b9..53817d80b9e5 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart @@ -552,7 +552,9 @@ class AndroidWebViewController extends PlatformWebViewController { /// button). However, this is generally not necessary as the web page will /// often show its own UI to close out of fullscreen. Regardless of how the /// WebView exits fullscreen mode, WebView will invoke [onHideCustomWidget], - /// signaling for the application to remove the custom widget. + /// signaling for the application to remove the custom widget. If this value + /// is not set a default handler will be set when the controller is passed to + /// an `AndroidWebViewWidget`. /// /// The [onHideCustomWidget] notifies the host application that the custom /// widget must be hidden. After this call, web content will render in the @@ -875,6 +877,7 @@ class AndroidWebViewWidget extends PlatformWebViewWidget { ); }, onCreatePlatformView: (PlatformViewCreationParams params) { + _trySetDefaultOnShowCustomWidgetCallbacks(context); return _initAndroidView( params, displayWithHybridComposition: @@ -890,6 +893,28 @@ class AndroidWebViewWidget extends PlatformWebViewWidget { }, ); } + + // Attempt to handle custom views with a default implementation if it has not + // been set. + void _trySetDefaultOnShowCustomWidgetCallbacks(BuildContext context) { + final AndroidWebViewController controller = + _androidParams.controller as AndroidWebViewController; + + if (controller._onShowCustomWidgetCallback == null) { + controller.setCustomWidgetCallbacks( + onShowCustomWidget: + (Widget widget, OnHideCustomWidgetCallback callback) { + Navigator.of(context).push(MaterialPageRoute( + builder: (BuildContext context) => widget, + fullscreenDialog: true, + )); + }, + onHideCustomWidget: () { + Navigator.of(context).pop(); + }, + ); + } + } } /// Represents a Flutter implementation of the Android [View](https://developer.android.com/reference/android/view/View) From acfd11d43f7d4a811539fd971a2e3128a69a1f66 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Fri, 25 Aug 2023 16:29:10 -0400 Subject: [PATCH 34/35] add integration test --- .../webview_flutter_test.dart | 54 +++++++++++++++++++ .../lib/src/android_webview_controller.dart | 4 +- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart index 23388dd7daa8..bae12ff01e69 100644 --- a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart @@ -593,6 +593,60 @@ Future main() async { await expectLater(fullscreenEntered.future, completes); await expectLater(fullscreenExited.future, completes); }); + + testWidgets( + 'Video plays fullscreen without setting `setCustomWidgetCallbacks`', + (WidgetTester tester) async { + final Completer fullscreenEntered = Completer(); + final Completer fullscreenExited = Completer(); + final Completer pageLoaded = Completer(); + + final AndroidWebViewController controller = AndroidWebViewController( + const PlatformWebViewControllerCreationParams(), + ); + unawaited(controller.setJavaScriptMode(JavaScriptMode.unrestricted)); + unawaited(controller.setMediaPlaybackRequiresUserGesture(false)); + final AndroidNavigationDelegate delegate = AndroidNavigationDelegate( + const PlatformNavigationDelegateCreationParams(), + ); + unawaited(delegate.setOnPageFinished((_) => pageLoaded.complete())); + unawaited(controller.setPlatformNavigationDelegate(delegate)); + + await controller.loadRequest( + LoadRequestParams( + uri: Uri.parse( + 'data:text/html;charset=utf-8;base64,$videoTestBase64', + ), + ), + ); + + await tester.pumpWidget(Builder( + builder: (BuildContext context) { + return PlatformWebViewWidget( + PlatformWebViewWidgetCreationParams( + key: const Key('webview_widget'), + controller: controller, + ), + ).build(context); + }, + )); + + await pageLoaded.future; + + await tester.pumpAndSettle(); + + // Due to security reasons, Chrome doesn't allow to programmatically + // toggle a video to fullscreen unless the call is directly comming from + // a user triggered event. + // The top half of the loaded web content contains a clickable div, which + // is tapped using the code below, triggering a user event. + // + // The offset of 20 x 20 is chosen at random. + await tester.tapAt(const Offset(20, 20)); + + await expectLater(fullscreenEntered.future, completes); + await expectLater(fullscreenExited.future, completes); + }); }); group('Audio playback policy', () { diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart index 53817d80b9e5..8abbbaf43b0d 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart @@ -553,8 +553,8 @@ class AndroidWebViewController extends PlatformWebViewController { /// often show its own UI to close out of fullscreen. Regardless of how the /// WebView exits fullscreen mode, WebView will invoke [onHideCustomWidget], /// signaling for the application to remove the custom widget. If this value - /// is not set a default handler will be set when the controller is passed to - /// an `AndroidWebViewWidget`. + /// is `null` when passed to an `AndroidWebViewWidget`, a default handler + /// will be set. /// /// The [onHideCustomWidget] notifies the host application that the custom /// widget must be hidden. After this call, web content will render in the From 77445296bb4efedd9a7f29df8ca4a060b72cfc31 Mon Sep 17 00:00:00 2001 From: Maurice Parrish <10687576+bparrishMines@users.noreply.github.com> Date: Thu, 7 Sep 2023 11:11:19 -0400 Subject: [PATCH 35/35] switch to unit test --- .../webview_flutter_test.dart | 60 +--------------- .../lib/src/android_webview_controller.dart | 2 +- .../test/android_webview_controller_test.dart | 70 +++++++++++++++++++ 3 files changed, 74 insertions(+), 58 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart index bae12ff01e69..0e805dd2aef4 100644 --- a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart @@ -553,9 +553,9 @@ Future main() async { unawaited(controller.setCustomWidgetCallbacks(onHideCustomWidget: () { fullscreenExited.complete(); }, onShowCustomWidget: - (Widget webView, void Function()? onHideCustomView) { + (Widget webView, void Function() onHideCustomView) { fullscreenEntered.complete(); - onHideCustomView!(); + onHideCustomView(); })); await controller.loadRequest( @@ -582,61 +582,7 @@ Future main() async { await tester.pumpAndSettle(); // Due to security reasons, Chrome doesn't allow to programmatically - // toggle a video to fullscreen unless the call is directly comming from - // a user triggered event. - // The top half of the loaded web content contains a clickable div, which - // is tapped using the code below, triggering a user event. - // - // The offset of 20 x 20 is chosen at random. - await tester.tapAt(const Offset(20, 20)); - - await expectLater(fullscreenEntered.future, completes); - await expectLater(fullscreenExited.future, completes); - }); - - testWidgets( - 'Video plays fullscreen without setting `setCustomWidgetCallbacks`', - (WidgetTester tester) async { - final Completer fullscreenEntered = Completer(); - final Completer fullscreenExited = Completer(); - final Completer pageLoaded = Completer(); - - final AndroidWebViewController controller = AndroidWebViewController( - const PlatformWebViewControllerCreationParams(), - ); - unawaited(controller.setJavaScriptMode(JavaScriptMode.unrestricted)); - unawaited(controller.setMediaPlaybackRequiresUserGesture(false)); - final AndroidNavigationDelegate delegate = AndroidNavigationDelegate( - const PlatformNavigationDelegateCreationParams(), - ); - unawaited(delegate.setOnPageFinished((_) => pageLoaded.complete())); - unawaited(controller.setPlatformNavigationDelegate(delegate)); - - await controller.loadRequest( - LoadRequestParams( - uri: Uri.parse( - 'data:text/html;charset=utf-8;base64,$videoTestBase64', - ), - ), - ); - - await tester.pumpWidget(Builder( - builder: (BuildContext context) { - return PlatformWebViewWidget( - PlatformWebViewWidgetCreationParams( - key: const Key('webview_widget'), - controller: controller, - ), - ).build(context); - }, - )); - - await pageLoaded.future; - - await tester.pumpAndSettle(); - - // Due to security reasons, Chrome doesn't allow to programmatically - // toggle a video to fullscreen unless the call is directly comming from + // toggle a video to fullscreen unless the call is directly coming from // a user triggered event. // The top half of the loaded web content contains a clickable div, which // is tapped using the code below, triggering a user event. diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart index 8abbbaf43b0d..bc1da74bf952 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_controller.dart @@ -859,6 +859,7 @@ class AndroidWebViewWidget extends PlatformWebViewWidget { @override Widget build(BuildContext context) { + _trySetDefaultOnShowCustomWidgetCallbacks(context); return PlatformViewLink( // Setting a default key using `params` ensures the `PlatformViewLink` // recreates the PlatformView when changes are made. @@ -877,7 +878,6 @@ class AndroidWebViewWidget extends PlatformWebViewWidget { ); }, onCreatePlatformView: (PlatformViewCreationParams params) { - _trySetDefaultOnShowCustomWidgetCallbacks(context); return _initAndroidView( params, displayWithHybridComposition: diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart index aec681a9fc9a..c350be64f2cf 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_controller_test.dart @@ -1311,6 +1311,76 @@ void main() { ); }); + testWidgets('default handling of custom views', + (WidgetTester tester) async { + final MockWebChromeClient mockWebChromeClient = MockWebChromeClient(); + + void Function( + android_webview.WebChromeClient instance, + android_webview.View view, + android_webview.CustomViewCallback callback)? + onShowCustomViewCallback; + + final AndroidWebViewController controller = createControllerWithMocks( + createWebChromeClient: ({ + dynamic onProgressChanged, + dynamic onShowFileChooser, + dynamic onGeolocationPermissionsShowPrompt, + dynamic onGeolocationPermissionsHidePrompt, + dynamic onPermissionRequest, + void Function( + android_webview.WebChromeClient instance, + android_webview.View view, + android_webview.CustomViewCallback callback)? + onShowCustomView, + dynamic onHideCustomView, + }) { + onShowCustomViewCallback = onShowCustomView; + return mockWebChromeClient; + }, + ); + + final MockPlatformViewsServiceProxy mockPlatformViewsService = + MockPlatformViewsServiceProxy(); + + when( + mockPlatformViewsService.initSurfaceAndroidView( + id: anyNamed('id'), + viewType: anyNamed('viewType'), + layoutDirection: anyNamed('layoutDirection'), + creationParams: anyNamed('creationParams'), + creationParamsCodec: anyNamed('creationParamsCodec'), + onFocus: anyNamed('onFocus'), + ), + ).thenReturn(MockSurfaceAndroidViewController()); + + final AndroidWebViewWidget webViewWidget = AndroidWebViewWidget( + AndroidWebViewWidgetCreationParams( + key: const Key('test_web_view'), + controller: controller, + platformViewsServiceProxy: mockPlatformViewsService, + ), + ); + + await tester.pumpWidget( + MaterialApp( + home: Builder( + builder: (BuildContext context) => webViewWidget.build(context), + ), + ), + ); + await tester.pumpAndSettle(); + + onShowCustomViewCallback!( + MockWebChromeClient(), + android_webview.WebView.detached(), + android_webview.CustomViewCallback.detached(), + ); + await tester.pumpAndSettle(); + + expect(find.byType(AndroidCustomViewWidget), findsOneWidget); + }); + testWidgets('PlatformView is recreated when the controller changes', (WidgetTester tester) async { final MockPlatformViewsServiceProxy mockPlatformViewsService =