From 0c2fde1bd517ef95ab30e5bcf42c3dba20bf167d Mon Sep 17 00:00:00 2001 From: TheVinhLuong Date: Tue, 30 May 2023 22:20:58 +0700 Subject: [PATCH] Make dart low-level code for offset changes listener mirror the Android API closely --- .../GeneratedAndroidWebView.java | 15 + .../webviewflutter/WebViewFlutterApiImpl.java | 14 +- .../webviewflutter/WebViewHostApiImpl.java | 6 +- .../plugins/webviewflutter/WebViewTest.java | 4 +- .../webview_flutter_test.dart | 19 +- .../lib/src/android_proxy.dart | 4 +- .../lib/src/android_webview.g.dart | 34 + .../lib/src/android_webview_api_impls.dart | 7 +- .../lib/src/android_webview_controller.dart | 11 +- .../pigeons/android_webview.dart | 3 +- ...ndroid_navigation_delegate_test.mocks.dart | 4 +- .../test/android_webview_controller_test.dart | 8 +- ...android_webview_controller_test.mocks.dart | 4 +- ...oid_webview_cookie_manager_test.mocks.dart | 15 +- .../test/android_webview_test.mocks.dart | 4 +- .../test/instance_manager_test.mocks.dart | 4 +- ...iew_android_cookie_manager_test.mocks.dart | 4 +- .../webview_android_widget_test.mocks.dart | 4 +- .../test/test_android_webview.g.dart | 618 ++++++++++++------ .../lib/src/platform_webview_controller.dart | 4 +- .../lib/src/types/content_offset_change.dart | 10 +- 21 files changed, 544 insertions(+), 252 deletions(-) diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java index 4dc43fa1d9db..ad7cb651e88d 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java @@ -1575,6 +1575,21 @@ public void create(@NonNull Long identifierArg, @NonNull Reply callback) { new ArrayList(Collections.singletonList(identifierArg)), channelReply -> callback.reply(null)); } + + public void onScrollChanged( + @NonNull Long webViewInstanceIdArg, + @NonNull Long xArg, + @NonNull Long yArg, + @NonNull Long oldXArg, + @NonNull Long oldYArg, + @NonNull Reply callback) { + BasicMessageChannel channel = + new BasicMessageChannel<>( + binaryMessenger, "dev.flutter.pigeon.WebViewFlutterApi.onScrollChanged", getCodec()); + channel.send( + new ArrayList(Arrays.asList(webViewInstanceIdArg, xArg, yArg, oldXArg, oldYArg)), + channelReply -> callback.reply(null)); + } } /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ public interface WebSettingsHostApi { diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterApiImpl.java index 279900c2dd3f..a108a46e65a0 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewFlutterApiImpl.java @@ -60,13 +60,17 @@ void setApi(@NonNull WebViewFlutterApi api) { public void onScrollChanged( @NonNull WebView instance, - @NonNull Long xArg, - @NonNull Long yArg, + @NonNull Long x, + @NonNull Long y, + @NonNull Long oldX, + @NonNull Long oldY, @NonNull WebViewFlutterApi.Reply callback) { - api.onScrollPosChange( + api.onScrollChanged( Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(instance)), - xArg, - yArg, + x, + y, + oldX, + oldY, callback); } } diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewHostApiImpl.java index 89a9ca10a49e..10d2ddbe4b05 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewHostApiImpl.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewHostApiImpl.java @@ -157,10 +157,10 @@ public WebChromeClient getWebChromeClient() { } @Override - protected void onScrollChanged(int l, int t, int oldL, int oldT) { - super.onScrollChanged(l, t, oldL, oldT); + protected void onScrollChanged(int left, int top, int oldLeft, int oldTop) { + super.onScrollChanged(left, top, oldLeft, oldTop); api.onScrollChanged( - this, (long) l, (long) t, reply -> {}); + this, (long) left, (long) top, (long) oldLeft, (long) oldTop, reply -> {}); } /** diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewTest.java index ccfd65d3977f..5fa1899a49f5 100644 --- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewTest.java +++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewTest.java @@ -368,12 +368,12 @@ public void onScrollChanged() { flutterApiImpl.setApi(mockFlutterApi); flutterApiImpl.create(mockWebView, reply -> {}); - flutterApiImpl.onScrollChanged(mockWebView, 0L, 1L, reply -> {}); + flutterApiImpl.onScrollChanged(mockWebView, 0L, 1L, 2L, 3L, reply -> {}); final long instanceIdentifier = Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(mockWebView)); verify(mockFlutterApi) - .onScrollPosChange(eq(instanceIdentifier), eq(0L), eq(1L), any()); + .onScrollChanged(eq(instanceIdentifier), eq(0L), eq(1L), eq(2L), eq(3L), any()); instanceManager.stopFinalizationListener(); } diff --git a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart index 903804ed036b..859b105f820a 100644 --- a/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart +++ b/packages/webview_flutter/webview_flutter_android/example/integration_test/webview_flutter_test.dart @@ -684,7 +684,8 @@ Future main() async { base64Encode(const Utf8Encoder().convert(scrollTestPage)); final Completer pageLoaded = Completer(); - Completer offsetsCompleter = Completer(); + Completer offsetsCompleter = + Completer(); final PlatformWebViewController controller = PlatformWebViewController( const PlatformWebViewControllerCreationParams(), ) @@ -701,9 +702,7 @@ Future main() async { ), ), ) - ..setOnContentOffsetChanged( - (ContentOffsetChange contentOffsetChange) { - print('comppp $contentOffsetChange'); + ..setOnContentOffsetChanged((ContentOffsetChange contentOffsetChange) { offsetsCompleter.complete(contentOffsetChange); }); @@ -734,8 +733,11 @@ Future main() async { expect(scrollPos.dx, X_SCROLL); expect(scrollPos.dy, Y_SCROLL); await expectLater( - offsetsCompleter.future.then((ContentOffsetChange contentOffsetChange) => [contentOffsetChange.x, contentOffsetChange.y]), completion([X_SCROLL, Y_SCROLL])); - + offsetsCompleter.future.then( + (ContentOffsetChange contentOffsetChange) => + [contentOffsetChange.x, contentOffsetChange.y]), + completion([X_SCROLL, Y_SCROLL])); + // Check scrollBy() (on top of scrollTo()) offsetsCompleter = Completer(); await controller.scrollBy(X_SCROLL, Y_SCROLL); @@ -743,7 +745,10 @@ Future main() async { expect(scrollPos.dx, X_SCROLL * 2); expect(scrollPos.dy, Y_SCROLL * 2); await expectLater( - offsetsCompleter.future.then((ContentOffsetChange contentOffsetChange) => [contentOffsetChange.x, contentOffsetChange.y]), completion([X_SCROLL * 2, Y_SCROLL * 2])); + offsetsCompleter.future.then( + (ContentOffsetChange contentOffsetChange) => + [contentOffsetChange.x, contentOffsetChange.y]), + completion([X_SCROLL * 2, Y_SCROLL * 2])); }); }); diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_proxy.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_proxy.dart index bd7b85783ca5..548d1c15327f 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_proxy.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_proxy.dart @@ -28,8 +28,8 @@ class AndroidWebViewProxy { /// Constructs a [android_webview.WebView]. final android_webview.WebView Function( - {Function(ContentOffsetChange contentOffsetChange)? - onScrollChanged}) createAndroidWebView; + {Function(ContentOffsetChange contentOffsetChange)? onScrollChanged}) + createAndroidWebView; /// Constructs a [android_webview.WebChromeClient]. final android_webview.WebChromeClient Function({ diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart index 5a2c56ef16ab..f8c7c2c78d52 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart @@ -1050,6 +1050,8 @@ abstract class WebViewFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int identifier); + void onScrollChanged(int webViewInstanceId, int x, int y, int oldX, int oldY); + static void setup(WebViewFlutterApi? api, {BinaryMessenger? binaryMessenger}) { { @@ -1071,6 +1073,38 @@ abstract class WebViewFlutterApi { }); } } + { + final BasicMessageChannel channel = BasicMessageChannel( + 'dev.flutter.pigeon.WebViewFlutterApi.onScrollChanged', codec, + binaryMessenger: binaryMessenger); + if (api == null) { + channel.setMessageHandler(null); + } else { + channel.setMessageHandler((Object? message) async { + assert(message != null, + 'Argument for dev.flutter.pigeon.WebViewFlutterApi.onScrollChanged was null.'); + final List args = (message as List?)!; + final int? arg_webViewInstanceId = (args[0] as int?); + assert(arg_webViewInstanceId != null, + 'Argument for dev.flutter.pigeon.WebViewFlutterApi.onScrollChanged was null, expected non-null int.'); + final int? arg_x = (args[1] as int?); + assert(arg_x != null, + 'Argument for dev.flutter.pigeon.WebViewFlutterApi.onScrollChanged was null, expected non-null int.'); + final int? arg_y = (args[2] as int?); + assert(arg_y != null, + 'Argument for dev.flutter.pigeon.WebViewFlutterApi.onScrollChanged was null, expected non-null int.'); + final int? arg_oldX = (args[3] as int?); + assert(arg_oldX != null, + 'Argument for dev.flutter.pigeon.WebViewFlutterApi.onScrollChanged was null, expected non-null int.'); + final int? arg_oldY = (args[4] as int?); + assert(arg_oldY != null, + 'Argument for dev.flutter.pigeon.WebViewFlutterApi.onScrollChanged was null, expected non-null int.'); + api.onScrollChanged( + arg_webViewInstanceId!, arg_x!, arg_y!, arg_oldX!, arg_oldY!); + return; + }); + } + } } } diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart index 8f62d1423fb4..783967ef702c 100644 --- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart +++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview_api_impls.dart @@ -8,7 +8,8 @@ import 'dart:typed_data'; import 'dart:ui'; import 'package:flutter/services.dart' show BinaryMessenger; -import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart' show ContentOffsetChange; +import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart' + show ContentOffsetChange; import 'android_webview.dart'; import 'android_webview.g.dart'; @@ -384,8 +385,8 @@ class WebViewFlutterApiImpl implements WebViewFlutterApi { } @override - void onScrollPosChange( - int webViewInstanceId, int x, int y) { + void onScrollChanged( + int webViewInstanceId, int x, int y, int oldX, int oldY) { final WebView? webViewInstance = instanceManager .getInstanceWithWeakReference(webViewInstanceId) as WebView?; assert( 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 4728e1da09aa..79098a50535d 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 @@ -105,11 +105,12 @@ class AndroidWebViewController extends PlatformWebViewController { _androidWebViewParams.androidWebViewProxy.createAndroidWebView( onScrollChanged: withWeakReferenceTo(this, (WeakReference weakReference) { - return (ContentOffsetChange contentOffsetChange) async { - final Function(ContentOffsetChange)? callback = weakReference.target?._onContentOffsetChangedCallback; - callback?.call(contentOffsetChange); - }; - })); + return (ContentOffsetChange contentOffsetChange) async { + final Function(ContentOffsetChange)? callback = + weakReference.target?._onContentOffsetChangedCallback; + callback?.call(contentOffsetChange); + }; + })); late final android_webview.WebChromeClient _webChromeClient = _androidWebViewParams.androidWebViewProxy.createAndroidWebChromeClient( diff --git a/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart b/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart index aaefacf88aec..a20d4970f68b 100644 --- a/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart +++ b/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart @@ -229,8 +229,7 @@ abstract class WebViewFlutterApi { /// Create a new Dart instance and add it to the `InstanceManager`. void create(int identifier); - void onScrollPosChange( - int webViewInstanceId, int x, int y); + void onScrollChanged(int webViewInstanceId, int x, int y, int oldX, int oldY); } @HostApi(dartHostTestHandler: 'TestWebSettingsHostApi') diff --git a/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.mocks.dart index aa0bf6569d8d..37eaec813c02 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.mocks.dart @@ -1,7 +1,9 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.1 from annotations // in webview_flutter_android/test/android_navigation_delegate_test.dart. // Do not manually edit this file. +// @dart=2.19 + // ignore_for_file: no_leading_underscores_for_library_prefixes import 'package:mockito/mockito.dart' as _i1; 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 510792206be8..497b1a9576fc 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 @@ -90,9 +90,11 @@ void main() { )? onPermissionRequest, }) => MockWebChromeClient(), - createAndroidWebView: - ({dynamic Function(ContentOffsetChange contentOffsetChange)? onScrollChanged}) => - nonNullMockWebView, + createAndroidWebView: ( + {dynamic Function( + ContentOffsetChange contentOffsetChange)? + onScrollChanged}) => + nonNullMockWebView, createAndroidWebViewClient: ({ void Function(android_webview.WebView webView, String url)? onPageFinished, 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 345af2713faa..d38d82c5cb1f 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 @@ -1,7 +1,9 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.1 from annotations // in webview_flutter_android/test/android_webview_controller_test.dart. // Do not manually edit this file. +// @dart=2.19 + // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i9; import 'dart:typed_data' as _i14; diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart index 9f4aa1dfc706..e56b8aa6f811 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_cookie_manager_test.mocks.dart @@ -1,7 +1,9 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.1 from annotations // in webview_flutter_android/test/android_webview_cookie_manager_test.dart. // Do not manually edit this file. +// @dart=2.19 + // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i5; import 'dart:ui' as _i4; @@ -412,6 +414,17 @@ class MockAndroidWebViewController extends _i1.Mock returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override + _i5.Future setOnContentOffsetChanged( + void Function(_i3.ContentOffsetChange)? onOffsetChange) => + (super.noSuchMethod( + Invocation.method( + #setOnContentOffsetChanged, + [onOffsetChange], + ), + returnValue: _i5.Future.value(), + returnValueForMissingStub: _i5.Future.value(), + ) as _i5.Future); + @override _i5.Future setMediaPlaybackRequiresUserGesture(bool? require) => (super.noSuchMethod( Invocation.method( diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_test.mocks.dart index 3b55d856d05b..9f64b525b9b5 100644 --- a/packages/webview_flutter/webview_flutter_android/test/android_webview_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_test.mocks.dart @@ -1,7 +1,9 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.1 from annotations // in webview_flutter_android/test/android_webview_test.dart. // Do not manually edit this file. +// @dart=2.19 + // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i5; import 'dart:typed_data' as _i7; diff --git a/packages/webview_flutter/webview_flutter_android/test/instance_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/instance_manager_test.mocks.dart index c9e6e4bfadac..d071991ab0c4 100644 --- a/packages/webview_flutter/webview_flutter_android/test/instance_manager_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/instance_manager_test.mocks.dart @@ -1,7 +1,9 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.1 from annotations // in webview_flutter_android/test/instance_manager_test.dart. // Do not manually edit this file. +// @dart=2.19 + // ignore_for_file: no_leading_underscores_for_library_prefixes import 'package:mockito/mockito.dart' as _i1; diff --git a/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_cookie_manager_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_cookie_manager_test.mocks.dart index 864dbaa04aa0..df06f6252274 100644 --- a/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_cookie_manager_test.mocks.dart +++ b/packages/webview_flutter/webview_flutter_android/test/legacy/webview_android_cookie_manager_test.mocks.dart @@ -1,7 +1,9 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.1 from annotations // in webview_flutter_android/test/legacy/webview_android_cookie_manager_test.dart. // Do not manually edit this file. +// @dart=2.19 + // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i3; 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 b82f8dea91e6..c52703812fe6 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 @@ -1,7 +1,9 @@ -// Mocks generated by Mockito 5.4.0 from annotations +// Mocks generated by Mockito 5.4.1 from annotations // in webview_flutter_android/test/legacy/webview_android_widget_test.dart. // Do not manually edit this file. +// @dart=2.19 + // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i5; import 'dart:typed_data' as _i6; diff --git a/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart index 2fe12d34611c..20b084e40c3c 100644 --- a/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart +++ b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart @@ -15,7 +15,8 @@ import 'package:webview_flutter_android/src/android_webview.g.dart'; /// Host API for managing the native `InstanceManager`. abstract class TestInstanceManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Clear the native `InstanceManager`. @@ -23,15 +24,19 @@ abstract class TestInstanceManagerHostApi { /// This is typically only used after a hot restart. void clear(); - static void setup(TestInstanceManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestInstanceManagerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.InstanceManagerHostApi.clear', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { // ignore message api.clear(); return []; @@ -47,22 +52,27 @@ abstract class TestInstanceManagerHostApi { /// /// See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html. abstract class TestJavaObjectHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void dispose(int identifier); - static void setup(TestJavaObjectHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestJavaObjectHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaObjectHostApi.dispose', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); + 'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.'); final List args = (message as List?)!; final int? arg_identifier = (args[0] as int?); assert(arg_identifier != null, @@ -220,7 +230,7 @@ class _TestWebViewHostApiCodec extends StandardMessageCodec { @override Object? readValueOfType(int type, ReadBuffer buffer) { switch (type) { - case 128: + case 128: return WebViewPoint.decode(readValue(buffer)!); default: return super.readValueOfType(type, buffer); @@ -229,14 +239,17 @@ class _TestWebViewHostApiCodec extends StandardMessageCodec { } abstract class TestWebViewHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = _TestWebViewHostApiCodec(); void create(int instanceId); - void loadData(int instanceId, String data, String? mimeType, String? encoding); + void loadData( + int instanceId, String data, String? mimeType, String? encoding); - void loadDataWithBaseUrl(int instanceId, String? baseUrl, String data, String? mimeType, String? encoding, String? historyUrl); + void loadDataWithBaseUrl(int instanceId, String? baseUrl, String data, + String? mimeType, String? encoding, String? historyUrl); void loadUrl(int instanceId, String url, Map headers); @@ -284,17 +297,21 @@ abstract class TestWebViewHostApi { void setBackgroundColor(int instanceId, int color); - static void setup(TestWebViewHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebViewHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -309,11 +326,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.loadData', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -333,11 +353,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -349,7 +372,8 @@ abstract class TestWebViewHostApi { final String? arg_mimeType = (args[3] as String?); final String? arg_encoding = (args[4] as String?); final String? arg_historyUrl = (args[5] as String?); - api.loadDataWithBaseUrl(arg_instanceId!, arg_baseUrl, arg_data!, arg_mimeType, arg_encoding, arg_historyUrl); + api.loadDataWithBaseUrl(arg_instanceId!, arg_baseUrl, arg_data!, + arg_mimeType, arg_encoding, arg_historyUrl); return []; }); } @@ -359,11 +383,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.loadUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -371,7 +398,8 @@ abstract class TestWebViewHostApi { final String? arg_url = (args[1] as String?); assert(arg_url != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null String.'); - final Map? arg_headers = (args[2] as Map?)?.cast(); + final Map? arg_headers = + (args[2] as Map?)?.cast(); assert(arg_headers != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null, expected non-null Map.'); api.loadUrl(arg_instanceId!, arg_url!, arg_headers!); @@ -384,11 +412,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.postUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -409,11 +440,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getUrl', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getUrl was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getUrl was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -428,11 +462,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.canGoBack', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoBack was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -447,11 +484,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.canGoForward', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoForward was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.canGoForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -466,11 +506,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.goBack', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.goBack was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.goBack was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -485,11 +528,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.goForward', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.goForward was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.goForward was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -504,11 +550,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.reload', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.reload was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.reload was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -523,11 +572,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.clearCache', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -545,11 +597,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.evaluateJavascript', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -557,7 +612,8 @@ abstract class TestWebViewHostApi { final String? arg_javascriptString = (args[1] as String?); assert(arg_javascriptString != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null, expected non-null String.'); - final String? output = await api.evaluateJavascript(arg_instanceId!, arg_javascriptString!); + final String? output = await api.evaluateJavascript( + arg_instanceId!, arg_javascriptString!); return [output]; }); } @@ -567,11 +623,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getTitle', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getTitle was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getTitle was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -586,11 +645,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.scrollTo', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -611,11 +673,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.scrollBy', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -636,11 +701,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getScrollX', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollX was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollX was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -655,11 +723,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getScrollY', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollY was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollY was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -674,11 +745,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.getScrollPosition', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollPosition was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollPosition was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -690,14 +764,18 @@ abstract class TestWebViewHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', codec, + 'dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled was null.'); final List args = (message as List?)!; final bool? arg_enabled = (args[0] as bool?); assert(arg_enabled != null, @@ -712,11 +790,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setWebViewClient', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -734,11 +815,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -746,7 +830,8 @@ abstract class TestWebViewHostApi { final int? arg_javaScriptChannelInstanceId = (args[1] as int?); assert(arg_javaScriptChannelInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null, expected non-null int.'); - api.addJavaScriptChannel(arg_instanceId!, arg_javaScriptChannelInstanceId!); + api.addJavaScriptChannel( + arg_instanceId!, arg_javaScriptChannelInstanceId!); return []; }); } @@ -756,11 +841,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -768,7 +856,8 @@ abstract class TestWebViewHostApi { final int? arg_javaScriptChannelInstanceId = (args[1] as int?); assert(arg_javaScriptChannelInstanceId != null, 'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null, expected non-null int.'); - api.removeJavaScriptChannel(arg_instanceId!, arg_javaScriptChannelInstanceId!); + api.removeJavaScriptChannel( + arg_instanceId!, arg_javaScriptChannelInstanceId!); return []; }); } @@ -778,11 +867,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setDownloadListener', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -798,11 +890,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setWebChromeClient', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -818,11 +913,14 @@ abstract class TestWebViewHostApi { 'dev.flutter.pigeon.WebViewHostApi.setBackgroundColor', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null.'); + 'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -839,7 +937,8 @@ abstract class TestWebViewHostApi { } abstract class TestWebSettingsHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId, int webViewInstanceId); @@ -870,17 +969,21 @@ abstract class TestWebSettingsHostApi { void setTextZoom(int instanceId, int textZoom); - static void setup(TestWebSettingsHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebSettingsHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebSettingsHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -898,11 +1001,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -917,14 +1023,18 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -932,21 +1042,26 @@ abstract class TestWebSettingsHostApi { final bool? arg_flag = (args[1] as bool?); assert(arg_flag != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null, expected non-null bool.'); - api.setJavaScriptCanOpenWindowsAutomatically(arg_instanceId!, arg_flag!); + api.setJavaScriptCanOpenWindowsAutomatically( + arg_instanceId!, arg_flag!); return []; }); } } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -964,11 +1079,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -986,11 +1104,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1003,14 +1124,18 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1018,7 +1143,8 @@ abstract class TestWebSettingsHostApi { final bool? arg_require = (args[1] as bool?); assert(arg_require != null, 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null, expected non-null bool.'); - api.setMediaPlaybackRequiresUserGesture(arg_instanceId!, arg_require!); + api.setMediaPlaybackRequiresUserGesture( + arg_instanceId!, arg_require!); return []; }); } @@ -1028,11 +1154,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1047,14 +1176,18 @@ abstract class TestWebSettingsHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', codec, + 'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1072,11 +1205,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1094,11 +1230,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1116,11 +1255,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1138,11 +1280,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1160,11 +1305,14 @@ abstract class TestWebSettingsHostApi { 'dev.flutter.pigeon.WebSettingsHostApi.setTextZoom', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setTextZoom was null.'); + 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setTextZoom was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1181,22 +1329,27 @@ abstract class TestWebSettingsHostApi { } abstract class TestJavaScriptChannelHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId, String channelName); - static void setup(TestJavaScriptChannelHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestJavaScriptChannelHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.JavaScriptChannelHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1213,24 +1366,30 @@ abstract class TestJavaScriptChannelHostApi { } abstract class TestWebViewClientHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - void setSynchronousReturnValueForShouldOverrideUrlLoading(int instanceId, bool value); + void setSynchronousReturnValueForShouldOverrideUrlLoading( + int instanceId, bool value); - static void setup(TestWebViewClientHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebViewClientHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebViewClientHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1242,14 +1401,18 @@ abstract class TestWebViewClientHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', codec, + 'dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null.'); + 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1257,7 +1420,8 @@ abstract class TestWebViewClientHostApi { final bool? arg_value = (args[1] as bool?); assert(arg_value != null, 'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null, expected non-null bool.'); - api.setSynchronousReturnValueForShouldOverrideUrlLoading(arg_instanceId!, arg_value!); + api.setSynchronousReturnValueForShouldOverrideUrlLoading( + arg_instanceId!, arg_value!); return []; }); } @@ -1266,22 +1430,27 @@ abstract class TestWebViewClientHostApi { } abstract class TestDownloadListenerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - static void setup(TestDownloadListenerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestDownloadListenerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.DownloadListenerHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.DownloadListenerHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.DownloadListenerHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1295,24 +1464,30 @@ abstract class TestDownloadListenerHostApi { } abstract class TestWebChromeClientHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); - void setSynchronousReturnValueForOnShowFileChooser(int instanceId, bool value); + void setSynchronousReturnValueForOnShowFileChooser( + int instanceId, bool value); - static void setup(TestWebChromeClientHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebChromeClientHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebChromeClientHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1324,14 +1499,18 @@ abstract class TestWebChromeClientHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', codec, + 'dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null.'); + 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1339,7 +1518,8 @@ abstract class TestWebChromeClientHostApi { final bool? arg_value = (args[1] as bool?); assert(arg_value != null, 'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null, expected non-null bool.'); - api.setSynchronousReturnValueForOnShowFileChooser(arg_instanceId!, arg_value!); + api.setSynchronousReturnValueForOnShowFileChooser( + arg_instanceId!, arg_value!); return []; }); } @@ -1348,24 +1528,29 @@ abstract class TestWebChromeClientHostApi { } abstract class TestAssetManagerHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); List list(String path); String getAssetFilePathByName(String name); - static void setup(TestAssetManagerHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestAssetManagerHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.FlutterAssetManagerHostApi.list', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.list was null.'); + 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.list was null.'); final List args = (message as List?)!; final String? arg_path = (args[0] as String?); assert(arg_path != null, @@ -1377,14 +1562,18 @@ abstract class TestAssetManagerHostApi { } { final BasicMessageChannel channel = BasicMessageChannel( - 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', codec, + 'dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName', + codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName was null.'); + 'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName was null.'); final List args = (message as List?)!; final String? arg_name = (args[0] as String?); assert(arg_name != null, @@ -1398,24 +1587,29 @@ abstract class TestAssetManagerHostApi { } abstract class TestWebStorageHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); void create(int instanceId); void deleteAllData(int instanceId); - static void setup(TestWebStorageHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestWebStorageHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.WebStorageHostApi.create', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebStorageHostApi.create was null.'); + 'Argument for dev.flutter.pigeon.WebStorageHostApi.create was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1430,11 +1624,14 @@ abstract class TestWebStorageHostApi { 'dev.flutter.pigeon.WebStorageHostApi.deleteAllData', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.WebStorageHostApi.deleteAllData was null.'); + 'Argument for dev.flutter.pigeon.WebStorageHostApi.deleteAllData was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, @@ -1455,7 +1652,8 @@ abstract class TestWebStorageHostApi { /// /// See https://developer.android.com/reference/android/webkit/PermissionRequest. abstract class TestPermissionRequestHostApi { - static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => TestDefaultBinaryMessengerBinding.instance; + static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding => + TestDefaultBinaryMessengerBinding.instance; static const MessageCodec codec = StandardMessageCodec(); /// Handles Dart method `PermissionRequest.grant`. @@ -1464,22 +1662,27 @@ abstract class TestPermissionRequestHostApi { /// Handles Dart method `PermissionRequest.deny`. void deny(int instanceId); - static void setup(TestPermissionRequestHostApi? api, {BinaryMessenger? binaryMessenger}) { + static void setup(TestPermissionRequestHostApi? api, + {BinaryMessenger? binaryMessenger}) { { final BasicMessageChannel channel = BasicMessageChannel( 'dev.flutter.pigeon.PermissionRequestHostApi.grant', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null.'); + 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null, expected non-null int.'); - final List? arg_resources = (args[1] as List?)?.cast(); + final List? arg_resources = + (args[1] as List?)?.cast(); assert(arg_resources != null, 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.grant was null, expected non-null List.'); api.grant(arg_instanceId!, arg_resources!); @@ -1492,11 +1695,14 @@ abstract class TestPermissionRequestHostApi { 'dev.flutter.pigeon.PermissionRequestHostApi.deny', codec, binaryMessenger: binaryMessenger); if (api == null) { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, null); + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, null); } else { - _testBinaryMessengerBinding!.defaultBinaryMessenger.setMockDecodedMessageHandler(channel, (Object? message) async { + _testBinaryMessengerBinding!.defaultBinaryMessenger + .setMockDecodedMessageHandler(channel, + (Object? message) async { assert(message != null, - 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.deny was null.'); + 'Argument for dev.flutter.pigeon.PermissionRequestHostApi.deny was null.'); final List args = (message as List?)!; final int? arg_instanceId = (args[0] as int?); assert(arg_instanceId != null, diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_webview_controller.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_webview_controller.dart index 95747128ba81..5c339b7c5c29 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_webview_controller.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/platform_webview_controller.dart @@ -8,7 +8,6 @@ import 'package:plugin_platform_interface/plugin_platform_interface.dart'; import 'platform_navigation_delegate.dart'; import 'types/types.dart'; -import 'types/content_offset_change.dart'; import 'webview_platform.dart' show WebViewPlatform; /// Interface for a platform implementation of a web view controller. @@ -274,8 +273,7 @@ abstract class PlatformWebViewController extends PlatformInterface { /// Toggle the listener for content offset changes. Set to null to stop listening. Future setOnContentOffsetChanged( - void Function(ContentOffsetChange contentOffsetChange)? - onOffsetChange) { + void Function(ContentOffsetChange contentOffsetChange)? onOffsetChange) { throw UnimplementedError( 'setOnContentOffsetChanged is not implemented on the current platform'); } diff --git a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/content_offset_change.dart b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/content_offset_change.dart index 83a066d5794e..9ad1aa2723e4 100644 --- a/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/content_offset_change.dart +++ b/packages/webview_flutter/webview_flutter_platform_interface/lib/src/types/content_offset_change.dart @@ -1,13 +1,15 @@ -import 'package:flutter/foundation.dart'; +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. /// Defines the parameters of the content offset change callback. class ContentOffsetChange { /// Creates a [ContentOffsetChange]. const ContentOffsetChange(this.x, this.y); - + /// The value of horizontal offset with the origin begin at the leftmost of the [WebView] final int x; - + /// The value of vertical offset with the origin begin at the topmost of the [WebView] final int y; -} \ No newline at end of file +}