diff --git a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md index 088dcb547c3e..7588903a6be3 100644 --- a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md +++ b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md @@ -1,3 +1,8 @@ +## 4.10.14 + +* Adds opt out of `displayCutout` and `systemBars` Android inset changes. See + https://chromium.googlesource.com/chromium/src/+/HEAD/android_webview/docs/insets.md#opt_out + ## 4.10.13 * Bumps androidx.webkit:webkit from 1.14.0 to 1.15.0. diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt index 71d26653c2e6..772096824ecc 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/AndroidWebkitLibrary.g.kt @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v26.1.4), do not edit directly. +// Autogenerated from Pigeon (v26.2.0), do not edit directly. // See also: https://pub.dev/packages/pigeon @file:Suppress("UNCHECKED_CAST", "ArrayInDataClass") @@ -708,6 +708,7 @@ private class AndroidWebkitLibraryPigeonProxyApiBaseCodec( value is OverScrollMode || value is SslErrorType || value is MixedContentMode || + value is WindowInsets || value == null) { super.writeValue(stream, value) return @@ -1098,6 +1099,47 @@ enum class MixedContentMode(val raw: Int) { } } +/** + * Defines different types of sources causing window insets. + * + * See https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type + */ +enum class WindowInsets(val raw: Int) { + /** + * All system bars. + * + * Includes statusBars(), captionBar() as well as navigationBars(), systemOverlays(), but not + * ime(). + */ + SYSTEM_BARS(0), + /** An inset type representing the area that used by DisplayCutout. */ + DISPLAY_CUTOUT(1), + /** An insets type representing the window of a caption bar. */ + CAPTION_BAR(2), + /** An insets type representing the window of an InputMethod. */ + IME(3), + MANDATORY_SYSTEM_GESTURES(4), + /** An insets type representing any system bars for navigation. */ + NAVIGATION_BARS(5), + /** An insets type representing any system bars for displaying status. */ + STATUS_BARS(6), + /** + * An insets type representing the system gesture insets. + * + * The system gesture insets represent the area of a window where system gestures have priority + * and may consume some or all touch input, e.g. due to the a system bar occupying it, or it being + * reserved for touch-only gestures. + */ + SYSTEM_GESTURES(7), + TAPPABLE_ELEMENT(8); + + companion object { + fun ofRaw(raw: Int): WindowInsets? { + return values().firstOrNull { it.raw == raw } + } + } +} + private open class AndroidWebkitLibraryPigeonCodec : StandardMessageCodec() { override fun readValueOfType(type: Byte, buffer: ByteBuffer): Any? { return when (type) { @@ -1116,6 +1158,9 @@ private open class AndroidWebkitLibraryPigeonCodec : StandardMessageCodec() { 133.toByte() -> { return (readValue(buffer) as Long?)?.let { MixedContentMode.ofRaw(it.toInt()) } } + 134.toByte() -> { + return (readValue(buffer) as Long?)?.let { WindowInsets.ofRaw(it.toInt()) } + } else -> super.readValueOfType(type, buffer) } } @@ -1142,6 +1187,10 @@ private open class AndroidWebkitLibraryPigeonCodec : StandardMessageCodec() { stream.write(133) writeValue(stream, value.raw.toLong()) } + is WindowInsets -> { + stream.write(134) + writeValue(stream, value.raw.toLong()) + } else -> super.writeValue(stream, value) } } @@ -5316,6 +5365,18 @@ abstract class PigeonApiView( /** Set the over-scroll mode for this view. */ abstract fun setOverScrollMode(pigeon_instance: android.view.View, mode: OverScrollMode) + /** + * Sets the listener to the native method `ViewCompat.setOnApplyWindowInsetsListener` to mark the + * passed insets to zero. + * + * This is a convenience method because `View.OnApplyWindowInsetsListener` requires implementing a + * callback that requires a synchronous return value. + */ + abstract fun setInsetListenerToSetInsetsToZero( + pigeon_instance: android.view.View, + insets: List + ) + companion object { @Suppress("LocalVariableName") fun setUpMessageHandlers(binaryMessenger: BinaryMessenger, api: PigeonApiView?) { @@ -5460,6 +5521,30 @@ abstract class PigeonApiView( channel.setMessageHandler(null) } } + run { + val channel = + BasicMessageChannel( + binaryMessenger, + "dev.flutter.pigeon.webview_flutter_android.View.setInsetListenerToSetInsetsToZero", + codec) + if (api != null) { + channel.setMessageHandler { message, reply -> + val args = message as List + val pigeon_instanceArg = args[0] as android.view.View + val insetsArg = args[1] as List + val wrapped: List = + try { + api.setInsetListenerToSetInsetsToZero(pigeon_instanceArg, insetsArg) + listOf(null) + } catch (exception: Throwable) { + AndroidWebkitLibraryPigeonUtils.wrapError(exception) + } + reply.reply(wrapped) + } + } else { + channel.setMessageHandler(null) + } + } } } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewProxyApi.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewProxyApi.java index 291767e4bb5d..792ec805f6fb 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewProxyApi.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/ViewProxyApi.java @@ -6,6 +6,10 @@ import android.view.View; import androidx.annotation.NonNull; +import androidx.core.graphics.Insets; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; +import java.util.List; /** * Flutter API implementation for `View`. @@ -67,4 +71,55 @@ public void setOverScrollMode(@NonNull View pigeon_instance, @NonNull OverScroll throw getPigeonRegistrar().createUnknownEnumException(OverScrollMode.UNKNOWN); } } + + @Override + public void setInsetListenerToSetInsetsToZero( + @NonNull View pigeon_instance, @NonNull List insets) { + if (insets.isEmpty()) { + ViewCompat.setOnApplyWindowInsetsListener( + pigeon_instance, (view, windowInsets) -> windowInsets); + return; + } + + int typeMaskAccumulator = 0; + for (WindowInsets inset : insets) { + switch (inset) { + case SYSTEM_BARS: + typeMaskAccumulator |= WindowInsetsCompat.Type.systemBars(); + break; + case DISPLAY_CUTOUT: + typeMaskAccumulator |= WindowInsetsCompat.Type.displayCutout(); + break; + case CAPTION_BAR: + typeMaskAccumulator |= WindowInsetsCompat.Type.captionBar(); + break; + case IME: + typeMaskAccumulator |= WindowInsetsCompat.Type.ime(); + break; + case MANDATORY_SYSTEM_GESTURES: + typeMaskAccumulator |= WindowInsetsCompat.Type.mandatorySystemGestures(); + break; + case NAVIGATION_BARS: + typeMaskAccumulator |= WindowInsetsCompat.Type.navigationBars(); + break; + case STATUS_BARS: + typeMaskAccumulator |= WindowInsetsCompat.Type.statusBars(); + break; + case SYSTEM_GESTURES: + typeMaskAccumulator |= WindowInsetsCompat.Type.systemGestures(); + break; + case TAPPABLE_ELEMENT: + typeMaskAccumulator |= WindowInsetsCompat.Type.tappableElement(); + break; + } + } + final int insetsTypeMask = typeMaskAccumulator; + + ViewCompat.setOnApplyWindowInsetsListener( + pigeon_instance, + (view, windowInsets) -> + new WindowInsetsCompat.Builder(windowInsets) + .setInsets(insetsTypeMask, Insets.NONE) + .build()); + } } 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 aef6c6f0a7a6..666cc7dfa027 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 @@ -5,12 +5,21 @@ package io.flutter.plugins.webviewflutter; import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import android.view.View; +import androidx.core.graphics.Insets; +import androidx.core.view.OnApplyWindowInsetsListener; +import androidx.core.view.ViewCompat; +import androidx.core.view.WindowInsetsCompat; +import java.util.List; import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.MockedStatic; public class ViewTest { @Test @@ -82,4 +91,32 @@ public void setOverScrollMode() { verify(instance).setOverScrollMode(View.OVER_SCROLL_ALWAYS); } + + @Test + public void setInsetListenerToSetInsetsToZero() { + final PigeonApiView api = new TestProxyApiRegistrar().getPigeonApiView(); + + final View instance = mock(View.class); + final WindowInsetsCompat originalInsets = + new WindowInsetsCompat.Builder() + .setInsets(WindowInsetsCompat.Type.systemBars(), Insets.of(1, 2, 3, 4)) + .setInsets(WindowInsetsCompat.Type.displayCutout(), Insets.of(4, 5, 6, 7)) + .build(); + + try (MockedStatic viewCompatMockedStatic = mockStatic(ViewCompat.class)) { + api.setInsetListenerToSetInsetsToZero( + instance, List.of(WindowInsets.SYSTEM_BARS, WindowInsets.DISPLAY_CUTOUT)); + + final ArgumentCaptor listenerCaptor = + ArgumentCaptor.forClass(OnApplyWindowInsetsListener.class); + viewCompatMockedStatic.verify( + () -> ViewCompat.setOnApplyWindowInsetsListener(eq(instance), listenerCaptor.capture())); + + final WindowInsetsCompat newInsets = + listenerCaptor.getValue().onApplyWindowInsets(instance, originalInsets); + + assertEquals(Insets.NONE, newInsets.getInsets(WindowInsetsCompat.Type.systemBars())); + assertEquals(Insets.NONE, newInsets.getInsets(WindowInsetsCompat.Type.displayCutout())); + } + } } diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.g.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.g.dart index 90f5fffb971c..19ef931c7cf1 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.g.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webkit.g.dart @@ -1,7 +1,7 @@ // Copyright 2013 The Flutter Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Autogenerated from Pigeon (v26.1.4), do not edit directly. +// Autogenerated from Pigeon (v26.2.0), 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, omit_obvious_local_variable_types, unused_shown_name, unnecessary_import, no_leading_underscores_for_local_identifiers @@ -14,11 +14,29 @@ import 'package:flutter/foundation.dart' import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart' show WidgetsFlutterBinding; -PlatformException _createConnectionError(String channelName) { - return PlatformException( - code: 'channel-error', - message: 'Unable to establish connection on channel: "$channelName".', - ); +Object? _extractReplyValueOrThrow( + List? replyList, + String channelName, { + required bool isNullValid, +}) { + if (replyList == null) { + throw PlatformException( + code: 'channel-error', + message: 'Unable to establish connection on channel: "$channelName".', + ); + } else if (replyList.length > 1) { + throw PlatformException( + code: replyList[0]! as String, + message: replyList[1] as String?, + details: replyList[2], + ); + } else if (!isNullValid && (replyList.isNotEmpty && replyList[0] == null)) { + throw PlatformException( + code: 'null-error', + message: 'Host platform returned null value for non-null return value.', + ); + } + return replyList.firstOrNull; } List wrapResponse({ @@ -675,17 +693,12 @@ class _PigeonInternalInstanceManagerApi { [identifier], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Clear the native `PigeonInstanceManager`. @@ -701,17 +714,12 @@ class _PigeonInternalInstanceManagerApi { ); final Future pigeonVar_sendFuture = pigeonVar_channel.send(null); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } } @@ -866,6 +874,42 @@ enum MixedContentMode { neverAllow, } +/// Defines different types of sources causing window insets. +/// +/// See https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type +enum WindowInsets { + /// All system bars. + /// + /// Includes statusBars(), captionBar() as well as navigationBars(), + /// systemOverlays(), but not ime(). + systemBars, + + /// An inset type representing the area that used by DisplayCutout. + displayCutout, + + /// An insets type representing the window of a caption bar. + captionBar, + + /// An insets type representing the window of an InputMethod. + ime, + mandatorySystemGestures, + + /// An insets type representing any system bars for navigation. + navigationBars, + + /// An insets type representing any system bars for displaying status. + statusBars, + + /// An insets type representing the system gesture insets. + /// + /// The system gesture insets represent the area of a window where system + /// gestures have priority and may consume some or all touch input, e.g. due + /// to the a system bar occupying it, or it being reserved for touch-only + /// gestures. + systemGestures, + tappableElement, +} + class _PigeonCodec extends StandardMessageCodec { const _PigeonCodec(); @override @@ -888,6 +932,9 @@ class _PigeonCodec extends StandardMessageCodec { } else if (value is MixedContentMode) { buffer.putUint8(133); writeValue(buffer, value.index); + } else if (value is WindowInsets) { + buffer.putUint8(134); + writeValue(buffer, value.index); } else { super.writeValue(buffer, value); } @@ -911,6 +958,9 @@ class _PigeonCodec extends StandardMessageCodec { case 133: final value = readValue(buffer) as int?; return value == null ? null : MixedContentMode.values[value]; + case 134: + final value = readValue(buffer) as int?; + return value == null ? null : WindowInsets.values[value]; default: return super.readValueOfType(type, buffer); } @@ -1684,17 +1734,12 @@ class CookieManager extends PigeonInternalProxyApiBaseClass { [pigeonVar_instanceIdentifier], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); }(); return pigeonVar_instance; } @@ -1715,17 +1760,12 @@ class CookieManager extends PigeonInternalProxyApiBaseClass { [this, url, value], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Removes all cookies. @@ -1744,22 +1784,13 @@ class CookieManager extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as bool; } /// Sets whether the `WebView` should allow third party cookies to be set. @@ -1778,17 +1809,12 @@ class CookieManager extends PigeonInternalProxyApiBaseClass { [this, webView, accept], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -1849,17 +1875,12 @@ class WebView extends View { ); () async { final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); }(); } @@ -2053,17 +2074,12 @@ class WebView extends View { [this, pigeonVar_instanceIdentifier], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); }(); return pigeonVar_instance; } @@ -2084,17 +2100,12 @@ class WebView extends View { [this, data, mimeType, encoding], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Loads the given data into this WebView, using baseUrl as the base URL for @@ -2120,17 +2131,12 @@ class WebView extends View { [this, baseUrl, data, mimeType, encoding, historyUrl], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Loads the given URL. @@ -2149,17 +2155,12 @@ class WebView extends View { [this, url, headers], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Loads the URL with postData using "POST" method into this WebView. @@ -2178,17 +2179,12 @@ class WebView extends View { [this, url, data], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Gets the URL for the current page. @@ -2207,17 +2203,13 @@ class WebView extends View { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as String?); - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return pigeonVar_replyValue as String?; } /// Gets whether this WebView has a back history item. @@ -2236,22 +2228,13 @@ class WebView extends View { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as bool; } /// Gets whether this WebView has a forward history item. @@ -2270,22 +2253,13 @@ class WebView extends View { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as bool; } /// Goes back in the history of this WebView. @@ -2304,17 +2278,12 @@ class WebView extends View { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Goes forward in the history of this WebView. @@ -2333,17 +2302,12 @@ class WebView extends View { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Reloads the current URL. @@ -2362,17 +2326,12 @@ class WebView extends View { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Clears the resource cache. @@ -2391,17 +2350,12 @@ class WebView extends View { [this, includeDiskFiles], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Asynchronously evaluates JavaScript in the context of the currently @@ -2421,17 +2375,13 @@ class WebView extends View { [this, javascriptString], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as String?); - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return pigeonVar_replyValue as String?; } /// Gets the title for the current page. @@ -2450,17 +2400,13 @@ class WebView extends View { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as String?); - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return pigeonVar_replyValue as String?; } /// Enables debugging of web contents (HTML / CSS / JavaScript) loaded into @@ -2489,17 +2435,12 @@ class WebView extends View { [enabled], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets the WebViewClient that will receive various notifications and @@ -2519,17 +2460,12 @@ class WebView extends View { [this, client], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Injects the supplied Java object into this WebView. @@ -2548,17 +2484,12 @@ class WebView extends View { [this, channel], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Removes a previously injected Java object from this WebView. @@ -2577,17 +2508,12 @@ class WebView extends View { [this, name], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Registers the interface to be used when content can not be handled by the @@ -2607,17 +2533,12 @@ class WebView extends View { [this, listener], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets the chrome handler. @@ -2636,17 +2557,12 @@ class WebView extends View { [this, client], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets the background color for this view. @@ -2665,17 +2581,12 @@ class WebView extends View { [this, color], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Destroys the internal state of this WebView. @@ -2694,17 +2605,12 @@ class WebView extends View { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -2804,17 +2710,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, flag], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Tells JavaScript to open windows automatically. @@ -2833,17 +2734,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, flag], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets whether the WebView whether supports multiple windows. @@ -2862,17 +2758,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, support], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Tells the WebView to enable JavaScript execution. @@ -2891,17 +2782,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, flag], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets the WebView's user-agent string. @@ -2920,17 +2806,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, userAgentString], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets whether the WebView requires a user gesture to play media. @@ -2949,17 +2830,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, require], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets whether the WebView should support zooming using its on-screen zoom @@ -2979,17 +2855,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, support], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets whether the WebView loads pages in overview mode, that is, zooms out @@ -3009,17 +2880,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, overview], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets whether the WebView should enable support for the "viewport" HTML @@ -3039,17 +2905,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, use], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets whether the WebView should display on-screen zoom controls when using @@ -3069,17 +2930,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, enabled], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets whether the WebView should display on-screen zoom controls when using @@ -3099,17 +2955,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, enabled], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Enables or disables file access within WebView. @@ -3128,17 +2979,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, enabled], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Enables or disables content URL access within WebView. @@ -3157,17 +3003,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, enabled], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets whether Geolocation is enabled within WebView. @@ -3186,17 +3027,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, enabled], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets the text zoom of the page in percent. @@ -3215,17 +3051,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, textZoom], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Gets the WebView's user-agent string. @@ -3244,22 +3075,13 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as String?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as String; } /// Configures the WebView's behavior when handling mixed content. @@ -3278,17 +3100,12 @@ class WebSettings extends PigeonInternalProxyApiBaseClass { [this, mode], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -3350,17 +3167,12 @@ class JavaScriptChannel extends PigeonInternalProxyApiBaseClass { ); () async { final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); }(); } @@ -3647,17 +3459,12 @@ class WebViewClient extends PigeonInternalProxyApiBaseClass { ); () async { final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); }(); } @@ -5150,17 +4957,12 @@ class WebViewClient extends PigeonInternalProxyApiBaseClass { [this, value], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -5240,17 +5042,12 @@ class DownloadListener extends PigeonInternalProxyApiBaseClass { ); () async { final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); }(); } @@ -5521,17 +5318,12 @@ class WebChromeClient extends PigeonInternalProxyApiBaseClass { ); () async { final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); }(); } @@ -6466,17 +6258,12 @@ class WebChromeClient extends PigeonInternalProxyApiBaseClass { [this, value], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets the required synchronous return value for the Java method, @@ -6507,17 +6294,12 @@ class WebChromeClient extends PigeonInternalProxyApiBaseClass { [this, value], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets the required synchronous return value for the Java method, @@ -6548,17 +6330,12 @@ class WebChromeClient extends PigeonInternalProxyApiBaseClass { [this, value], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets the required synchronous return value for the Java method, @@ -6589,17 +6366,12 @@ class WebChromeClient extends PigeonInternalProxyApiBaseClass { [this, value], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Sets the required synchronous return value for the Java method, @@ -6630,17 +6402,12 @@ class WebChromeClient extends PigeonInternalProxyApiBaseClass { [this, value], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -6764,17 +6531,12 @@ class FlutterAssetManager extends PigeonInternalProxyApiBaseClass { [pigeonVar_instanceIdentifier], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); }(); return pigeonVar_instance; } @@ -6797,22 +6559,13 @@ class FlutterAssetManager extends PigeonInternalProxyApiBaseClass { [this, path], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as List?)!.cast(); - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return (pigeonVar_replyValue as List).cast(); } /// Gets the relative file path to the Flutter asset with the given name, including the file's @@ -6837,22 +6590,13 @@ class FlutterAssetManager extends PigeonInternalProxyApiBaseClass { [this, name], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as String?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as String; } @override @@ -6961,17 +6705,12 @@ class WebStorage extends PigeonInternalProxyApiBaseClass { [pigeonVar_instanceIdentifier], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); }(); return pigeonVar_instance; } @@ -6992,17 +6731,12 @@ class WebStorage extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -7244,17 +6978,12 @@ class PermissionRequest extends PigeonInternalProxyApiBaseClass { [this, resources], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Call this method to deny the request. @@ -7273,17 +7002,12 @@ class PermissionRequest extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -7386,17 +7110,12 @@ class CustomViewCallback extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -7496,17 +7215,12 @@ class View extends PigeonInternalProxyApiBaseClass { [this, x, y], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Move the scrolled position of your view. @@ -7525,17 +7239,12 @@ class View extends PigeonInternalProxyApiBaseClass { [this, x, y], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Return the scrolled position of this view. @@ -7554,22 +7263,13 @@ class View extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as WebViewPoint?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as WebViewPoint; } /// Define whether the vertical scrollbar should be drawn or not. @@ -7590,17 +7290,12 @@ class View extends PigeonInternalProxyApiBaseClass { [this, enabled], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Define whether the horizontal scrollbar should be drawn or not. @@ -7621,17 +7316,12 @@ class View extends PigeonInternalProxyApiBaseClass { [this, enabled], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Set the over-scroll mode for this view. @@ -7650,17 +7340,43 @@ class View extends PigeonInternalProxyApiBaseClass { [this, mode], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + } + + /// Sets the listener to the native method + /// `ViewCompat.setOnApplyWindowInsetsListener` to mark the passed insets to + /// zero. + /// + /// This is a convenience method because `View.OnApplyWindowInsetsListener` + /// requires implementing a callback that requires a synchronous return value. + Future setInsetListenerToSetInsetsToZero( + List insets, + ) async { + final _PigeonInternalProxyApiBaseCodec pigeonChannelCodec = + _pigeonVar_codecView; + final BinaryMessenger? pigeonVar_binaryMessenger = pigeon_binaryMessenger; + const pigeonVar_channelName = + 'dev.flutter.pigeon.webview_flutter_android.View.setInsetListenerToSetInsetsToZero'; + final pigeonVar_channel = BasicMessageChannel( + pigeonVar_channelName, + pigeonChannelCodec, + binaryMessenger: pigeonVar_binaryMessenger, + ); + final Future pigeonVar_sendFuture = pigeonVar_channel.send( + [this, insets], + ); + final pigeonVar_replyList = await pigeonVar_sendFuture as List?; + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -7761,17 +7477,12 @@ class GeolocationPermissionsCallback extends PigeonInternalProxyApiBaseClass { [this, origin, allow, retain], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -7872,22 +7583,13 @@ class HttpAuthHandler extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as bool; } /// Instructs the WebView to cancel the authentication request.. @@ -7906,17 +7608,12 @@ class HttpAuthHandler extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Instructs the WebView to proceed with the authentication with the given @@ -7936,17 +7633,12 @@ class HttpAuthHandler extends PigeonInternalProxyApiBaseClass { [this, username, password], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -8049,17 +7741,12 @@ class AndroidMessage extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -8161,17 +7848,12 @@ class ClientCertRequest extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Ignore the request for now. @@ -8190,17 +7872,12 @@ class ClientCertRequest extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Proceed with the specified private key and client certificate chain. @@ -8222,17 +7899,12 @@ class ClientCertRequest extends PigeonInternalProxyApiBaseClass { [this, privateKey, chain], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -8492,17 +8164,12 @@ class SslErrorHandler extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } /// Instructs the WebView that encountered the SSL certificate error to ignore @@ -8522,17 +8189,12 @@ class SslErrorHandler extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -8653,22 +8315,13 @@ class SslError extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as SslErrorType?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as SslErrorType; } /// Determines whether this object includes the supplied error. @@ -8687,22 +8340,13 @@ class SslError extends PigeonInternalProxyApiBaseClass { [this, error], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as bool; } @override @@ -8808,22 +8452,13 @@ class SslCertificateDName extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as String?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as String; } /// The distinguished name (normally includes CN, O, and OU names). @@ -8842,22 +8477,13 @@ class SslCertificateDName extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as String?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as String; } /// The most specific Organization (O) component of this name. @@ -8876,22 +8502,13 @@ class SslCertificateDName extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as String?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as String; } /// The most specific Organizational Unit (OU) component of this name. @@ -8910,22 +8527,13 @@ class SslCertificateDName extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as String?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as String; } @override @@ -9024,17 +8632,13 @@ class SslCertificate extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as SslCertificateDName?); - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return pigeonVar_replyValue as SslCertificateDName?; } /// Issued-to distinguished name or null if none has been set. @@ -9053,17 +8657,13 @@ class SslCertificate extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as SslCertificateDName?); - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return pigeonVar_replyValue as SslCertificateDName?; } /// Not-after date from the certificate validity period or null if none has been @@ -9083,17 +8683,13 @@ class SslCertificate extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as int?); - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return pigeonVar_replyValue as int?; } /// Not-before date from the certificate validity period or null if none has @@ -9113,17 +8709,13 @@ class SslCertificate extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as int?); - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return pigeonVar_replyValue as int?; } /// The X509Certificate used to create this SslCertificate or null if no @@ -9145,17 +8737,13 @@ class SslCertificate extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return (pigeonVar_replyList[0] as X509Certificate?); - } + + final Object? pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); + return pigeonVar_replyValue as X509Certificate?; } @override @@ -9254,22 +8842,13 @@ class Certificate extends PigeonInternalProxyApiBaseClass { [this], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as Uint8List?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as Uint8List; } @override @@ -9382,17 +8961,12 @@ class WebSettingsCompat extends PigeonInternalProxyApiBaseClass { [webSettings, enabled], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else { - return; - } + + _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: true, + ); } @override @@ -9499,22 +9073,13 @@ class WebViewFeature extends PigeonInternalProxyApiBaseClass { [feature], ); final pigeonVar_replyList = await pigeonVar_sendFuture as List?; - if (pigeonVar_replyList == null) { - throw _createConnectionError(pigeonVar_channelName); - } else if (pigeonVar_replyList.length > 1) { - throw PlatformException( - code: pigeonVar_replyList[0]! as String, - message: pigeonVar_replyList[1] as String?, - details: pigeonVar_replyList[2], - ); - } else if (pigeonVar_replyList[0] == null) { - throw PlatformException( - code: 'null-error', - message: 'Host platform returned null value for non-null return value.', - ); - } else { - return (pigeonVar_replyList[0] as bool?)!; - } + + final Object pigeonVar_replyValue = _extractReplyValueOrThrow( + pigeonVar_replyList, + pigeonVar_channelName, + isNullValid: false, + )!; + return pigeonVar_replyValue as bool; } @override 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 00563080c4ec..83b65f34392b 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 @@ -118,6 +118,13 @@ class AndroidWebViewController extends PlatformWebViewController { _webView.settings.setUseWideViewPort(false); _webView.settings.setDisplayZoomControls(false); _webView.settings.setBuiltInZoomControls(true); + // Opt out of inset changes to systemBars and displayCutout insets. Flutter + // handles these internally. See + // https://chromium.googlesource.com/chromium/src/+/HEAD/android_webview/docs/insets.md#opt_out + _webView.setInsetListenerToSetInsetsToZero([ + android_webview.WindowInsets.systemBars, + android_webview.WindowInsets.displayCutout, + ]); _webView.setWebChromeClient(_webChromeClient); } diff --git a/packages/webview_flutter/webview_flutter_android/pigeons/android_webkit.dart b/packages/webview_flutter/webview_flutter_android/pigeons/android_webkit.dart index a6c73ab3e030..67a3ef0baa6f 100644 --- a/packages/webview_flutter/webview_flutter_android/pigeons/android_webkit.dart +++ b/packages/webview_flutter/webview_flutter_android/pigeons/android_webkit.dart @@ -141,6 +141,44 @@ enum MixedContentMode { neverAllow, } +/// Defines different types of sources causing window insets. +/// +/// See https://developer.android.com/reference/androidx/core/view/WindowInsetsCompat.Type +enum WindowInsets { + /// All system bars. + /// + /// Includes statusBars(), captionBar() as well as navigationBars(), + /// systemOverlays(), but not ime(). + systemBars, + + /// An inset type representing the area that used by DisplayCutout. + displayCutout, + + /// An insets type representing the window of a caption bar. + captionBar, + + /// An insets type representing the window of an InputMethod. + ime, + + mandatorySystemGestures, + + /// An insets type representing any system bars for navigation. + navigationBars, + + /// An insets type representing any system bars for displaying status. + statusBars, + + /// An insets type representing the system gesture insets. + /// + /// The system gesture insets represent the area of a window where system + /// gestures have priority and may consume some or all touch input, e.g. due + /// to the a system bar occupying it, or it being reserved for touch-only + /// gestures. + systemGestures, + + tappableElement, +} + /// Encompasses parameters to the `WebViewClient.shouldInterceptRequest` method. /// /// See https://developer.android.com/reference/android/webkit/WebResourceRequest. @@ -848,6 +886,14 @@ abstract class View { /// Set the over-scroll mode for this view. void setOverScrollMode(OverScrollMode mode); + + /// Sets the listener to the native method + /// `ViewCompat.setOnApplyWindowInsetsListener` to mark the passed insets to + /// zero. + /// + /// This is a convenience method because `View.OnApplyWindowInsetsListener` + /// requires implementing a callback that requires a synchronous return value. + void setInsetListenerToSetInsetsToZero(List insets); } /// A callback interface used by the host application to set the Geolocation diff --git a/packages/webview_flutter/webview_flutter_android/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/pubspec.yaml index 4415fcfbbaee..78524bbf12c0 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: 4.10.13 +version: 4.10.14 environment: sdk: ^3.9.0 @@ -28,7 +28,7 @@ dev_dependencies: flutter_test: sdk: flutter mockito: ^5.4.4 - pigeon: ^26.1.4 + pigeon: ^26.1.10 topics: - html 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 fa878c5d0da5..7518cafb0256 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 @@ -368,6 +368,13 @@ void main() { verify(mockWebSettings.setLoadWithOverviewMode(true)).called(1); verify(mockWebSettings.setSupportMultipleWindows(true)).called(1); verify(mockWebSettings.setUseWideViewPort(false)).called(1); + verify( + mockWebView + .setInsetListenerToSetInsetsToZero([ + android_webview.WindowInsets.systemBars, + android_webview.WindowInsets.displayCutout, + ]), + ).called(1); }); group('loadFile', () { 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 e5776a14a1a0..ea37eb9e14c3 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 @@ -78,26 +78,26 @@ class _FakeOffset_6 extends _i1.SmartFake implements _i4.Offset { : super(parent, parentInvocation); } -class _FakePigeonInstanceManager_7 extends _i1.SmartFake - implements _i2.PigeonInstanceManager { - _FakePigeonInstanceManager_7(Object parent, Invocation parentInvocation) +class _FakePlatformViewsServiceProxy_7 extends _i1.SmartFake + implements _i5.PlatformViewsServiceProxy { + _FakePlatformViewsServiceProxy_7(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakePlatformViewsServiceProxy_8 extends _i1.SmartFake - implements _i5.PlatformViewsServiceProxy { - _FakePlatformViewsServiceProxy_8(Object parent, Invocation parentInvocation) +class _FakePlatformWebViewController_8 extends _i1.SmartFake + implements _i3.PlatformWebViewController { + _FakePlatformWebViewController_8(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakePlatformWebViewController_9 extends _i1.SmartFake - implements _i3.PlatformWebViewController { - _FakePlatformWebViewController_9(Object parent, Invocation parentInvocation) +class _FakeSize_9 extends _i1.SmartFake implements _i4.Size { + _FakeSize_9(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } -class _FakeSize_10 extends _i1.SmartFake implements _i4.Size { - _FakeSize_10(Object parent, Invocation parentInvocation) +class _FakePigeonInstanceManager_10 extends _i1.SmartFake + implements _i2.PigeonInstanceManager { + _FakePigeonInstanceManager_10(Object parent, Invocation parentInvocation) : super(parent, parentInvocation); } @@ -869,29 +869,14 @@ class MockAndroidWebViewController extends _i1.Mock class MockAndroidWebViewWidgetCreationParams extends _i1.Mock implements _i7.AndroidWebViewWidgetCreationParams { @override - _i2.PigeonInstanceManager get instanceManager => - (super.noSuchMethod( - Invocation.getter(#instanceManager), - returnValue: _FakePigeonInstanceManager_7( - this, - Invocation.getter(#instanceManager), - ), - returnValueForMissingStub: _FakePigeonInstanceManager_7( - this, - Invocation.getter(#instanceManager), - ), - ) - as _i2.PigeonInstanceManager); - - @override _i5.PlatformViewsServiceProxy get platformViewsServiceProxy => (super.noSuchMethod( Invocation.getter(#platformViewsServiceProxy), - returnValue: _FakePlatformViewsServiceProxy_8( + returnValue: _FakePlatformViewsServiceProxy_7( this, Invocation.getter(#platformViewsServiceProxy), ), - returnValueForMissingStub: _FakePlatformViewsServiceProxy_8( + returnValueForMissingStub: _FakePlatformViewsServiceProxy_7( this, Invocation.getter(#platformViewsServiceProxy), ), @@ -911,11 +896,11 @@ class MockAndroidWebViewWidgetCreationParams extends _i1.Mock _i3.PlatformWebViewController get controller => (super.noSuchMethod( Invocation.getter(#controller), - returnValue: _FakePlatformWebViewController_9( + returnValue: _FakePlatformWebViewController_8( this, Invocation.getter(#controller), ), - returnValueForMissingStub: _FakePlatformWebViewController_9( + returnValueForMissingStub: _FakePlatformWebViewController_8( this, Invocation.getter(#controller), ), @@ -1032,10 +1017,10 @@ class MockExpensiveAndroidViewController extends _i1.Mock (super.noSuchMethod( Invocation.method(#setSize, [size]), returnValue: _i8.Future<_i4.Size>.value( - _FakeSize_10(this, Invocation.method(#setSize, [size])), + _FakeSize_9(this, Invocation.method(#setSize, [size])), ), returnValueForMissingStub: _i8.Future<_i4.Size>.value( - _FakeSize_10(this, Invocation.method(#setSize, [size])), + _FakeSize_9(this, Invocation.method(#setSize, [size])), ), ) as _i8.Future<_i4.Size>); @@ -1111,11 +1096,11 @@ class MockFlutterAssetManager extends _i1.Mock _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_7( + returnValue: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_7( + returnValueForMissingStub: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), @@ -1177,11 +1162,11 @@ class MockGeolocationPermissionsCallback extends _i1.Mock _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_7( + returnValue: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_7( + returnValueForMissingStub: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), @@ -1247,11 +1232,11 @@ class MockJavaScriptChannel extends _i1.Mock implements _i2.JavaScriptChannel { _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_7( + returnValue: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_7( + returnValueForMissingStub: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), @@ -1291,11 +1276,11 @@ class MockPermissionRequest extends _i1.Mock implements _i2.PermissionRequest { _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_7( + returnValue: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_7( + returnValueForMissingStub: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), @@ -1519,10 +1504,10 @@ class MockSurfaceAndroidViewController extends _i1.Mock (super.noSuchMethod( Invocation.method(#setSize, [size]), returnValue: _i8.Future<_i4.Size>.value( - _FakeSize_10(this, Invocation.method(#setSize, [size])), + _FakeSize_9(this, Invocation.method(#setSize, [size])), ), returnValueForMissingStub: _i8.Future<_i4.Size>.value( - _FakeSize_10(this, Invocation.method(#setSize, [size])), + _FakeSize_9(this, Invocation.method(#setSize, [size])), ), ) as _i8.Future<_i4.Size>); @@ -1652,11 +1637,11 @@ class MockWebChromeClient extends _i1.Mock implements _i2.WebChromeClient { _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_7( + returnValue: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_7( + returnValueForMissingStub: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), @@ -1738,11 +1723,11 @@ class MockWebSettings extends _i1.Mock implements _i2.WebSettings { _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_7( + returnValue: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_7( + returnValueForMissingStub: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), @@ -1953,11 +1938,11 @@ class MockWebView extends _i1.Mock implements _i2.WebView { _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_7( + returnValue: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_7( + returnValueForMissingStub: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), @@ -2249,6 +2234,17 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); + + @override + _i8.Future setInsetListenerToSetInsetsToZero( + List<_i2.WindowInsets>? insets, + ) => + (super.noSuchMethod( + Invocation.method(#setInsetListenerToSetInsetsToZero, [insets]), + returnValue: _i8.Future.value(), + returnValueForMissingStub: _i8.Future.value(), + ) + as _i8.Future); } /// A class which mocks [WebViewClient]. @@ -2259,11 +2255,11 @@ class MockWebViewClient extends _i1.Mock implements _i2.WebViewClient { _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_7( + returnValue: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_7( + returnValueForMissingStub: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), @@ -2308,11 +2304,11 @@ class MockWebStorage extends _i1.Mock implements _i2.WebStorage { _i2.PigeonInstanceManager get pigeon_instanceManager => (super.noSuchMethod( Invocation.getter(#pigeon_instanceManager), - returnValue: _FakePigeonInstanceManager_7( + returnValue: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), - returnValueForMissingStub: _FakePigeonInstanceManager_7( + returnValueForMissingStub: _FakePigeonInstanceManager_10( this, Invocation.getter(#pigeon_instanceManager), ), diff --git a/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.mocks.dart index eb020a5d61bd..4ec02c4e7457 100644 --- a/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_widget_test.mocks.dart @@ -672,6 +672,17 @@ class MockWebView extends _i1.Mock implements _i2.WebView { returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); + + @override + _i4.Future setInsetListenerToSetInsetsToZero( + List<_i2.WindowInsets>? insets, + ) => + (super.noSuchMethod( + Invocation.method(#setInsetListenerToSetInsetsToZero, [insets]), + returnValue: _i4.Future.value(), + returnValueForMissingStub: _i4.Future.value(), + ) + as _i4.Future); } /// A class which mocks [WebResourceRequest].