[webview_flutter_android] [webview_flutter_wkwebview] Adds support for `PlatformNavigationDelegate.onUrlChange` (#3653)
[webview_flutter_android] [webview_flutter_wkwebview] Adds support for `PlatformNavigationDelegate.onUrlChange`
diff --git a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md
index 953ec4d..abdeece 100644
--- a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md
+++ b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md
@@ -1,5 +1,6 @@
-## NEXT
+## 3.5.0
+* Adds support for `PlatformNavigationDelegate.onUrlChange`.
* Bumps androidx.webkit:webkit from 1.6.0 to 1.6.1.
* Fixes common typos in tests and documentation.
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 507c07a..5f26060 100644
--- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java
+++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java
@@ -1,7 +1,7 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Autogenerated from Pigeon (v9.0.5), do not edit directly.
+// Autogenerated from Pigeon (v9.2.3), do not edit directly.
// See also: https://pub.dev/packages/pigeon
package io.flutter.plugins.webviewflutter;
@@ -22,15 +22,39 @@
import java.util.Map;
/** Generated class from Pigeon. */
-@SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression"})
+@SuppressWarnings({"unused", "unchecked", "CodeBlock2Expr", "RedundantSuppression", "serial"})
public class GeneratedAndroidWebView {
+
+ /** Error class for passing custom error details to Flutter via a thrown PlatformException. */
+ public static class FlutterError extends RuntimeException {
+
+ /** The error code. */
+ public final String code;
+
+ /** The error details. Must be a datatype supported by the api codec. */
+ public final Object details;
+
+ public FlutterError(@NonNull String code, @Nullable String message, @Nullable Object details) {
+ super(message);
+ this.code = code;
+ this.details = details;
+ }
+ }
+
@NonNull
- private static ArrayList<Object> wrapError(@NonNull Throwable exception) {
+ protected static ArrayList<Object> wrapError(@NonNull Throwable exception) {
ArrayList<Object> errorList = new ArrayList<Object>(3);
- errorList.add(exception.toString());
- errorList.add(exception.getClass().getSimpleName());
- errorList.add(
- "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception));
+ if (exception instanceof FlutterError) {
+ FlutterError error = (FlutterError) exception;
+ errorList.add(error.code);
+ errorList.add(error.getMessage());
+ errorList.add(error.details);
+ } else {
+ errorList.add(exception.toString());
+ errorList.add(exception.getClass().getSimpleName());
+ errorList.add(
+ "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception));
+ }
return errorList;
}
@@ -63,7 +87,7 @@
*/
SAVE(2);
- private final int index;
+ final int index;
private FileChooserMode(final int index) {
this.index = index;
@@ -85,8 +109,8 @@
this.value = setterArg;
}
- /** Constructor is private to enforce null safety; use Builder. */
- private FileChooserModeEnumData() {}
+ /** Constructor is non-public to enforce null safety; use Builder. */
+ FileChooserModeEnumData() {}
public static final class Builder {
@@ -196,8 +220,8 @@
this.requestHeaders = setterArg;
}
- /** Constructor is private to enforce null safety; use Builder. */
- private WebResourceRequestData() {}
+ /** Constructor is non-public to enforce null safety; use Builder. */
+ WebResourceRequestData() {}
public static final class Builder {
@@ -313,8 +337,8 @@
this.description = setterArg;
}
- /** Constructor is private to enforce null safety; use Builder. */
- private WebResourceErrorData() {}
+ /** Constructor is non-public to enforce null safety; use Builder. */
+ WebResourceErrorData() {}
public static final class Builder {
@@ -389,8 +413,8 @@
this.y = setterArg;
}
- /** Constructor is private to enforce null safety; use Builder. */
- private WebViewPoint() {}
+ /** Constructor is non-public to enforce null safety; use Builder. */
+ WebViewPoint() {}
public static final class Builder {
@@ -435,9 +459,10 @@
}
public interface Result<T> {
+ @SuppressWarnings("UnknownNullness")
void success(T result);
- void error(Throwable error);
+ void error(@NonNull Throwable error);
}
/**
* Host API for managing the native `InstanceManager`.
@@ -453,14 +478,15 @@
void clear();
/** The codec used by InstanceManagerHostApi. */
- static MessageCodec<Object> getCodec() {
+ static @NonNull MessageCodec<Object> getCodec() {
return new StandardMessageCodec();
}
/**
* Sets up an instance of `InstanceManagerHostApi` to handle messages through the
* `binaryMessenger`.
*/
- static void setup(BinaryMessenger binaryMessenger, InstanceManagerHostApi api) {
+ static void setup(
+ @NonNull BinaryMessenger binaryMessenger, @Nullable InstanceManagerHostApi api) {
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
@@ -472,7 +498,7 @@
try {
api.clear();
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -498,13 +524,13 @@
void dispose(@NonNull Long identifier);
/** The codec used by JavaObjectHostApi. */
- static MessageCodec<Object> getCodec() {
+ static @NonNull MessageCodec<Object> getCodec() {
return new StandardMessageCodec();
}
/**
* Sets up an instance of `JavaObjectHostApi` to handle messages through the `binaryMessenger`.
*/
- static void setup(BinaryMessenger binaryMessenger, JavaObjectHostApi api) {
+ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable JavaObjectHostApi api) {
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
@@ -513,16 +539,12 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number identifierArg = (Number) args.get(0);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number identifierArg = (Number) args.get(0);
- if (identifierArg == null) {
- throw new NullPointerException("identifierArg unexpectedly null.");
- }
api.dispose((identifierArg == null) ? null : identifierArg.longValue());
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -542,22 +564,23 @@
* <p>Generated class from Pigeon that represents Flutter messages that can be called from Java.
*/
public static class JavaObjectFlutterApi {
- private final BinaryMessenger binaryMessenger;
+ private final @NonNull BinaryMessenger binaryMessenger;
- public JavaObjectFlutterApi(BinaryMessenger argBinaryMessenger) {
+ public JavaObjectFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) {
this.binaryMessenger = argBinaryMessenger;
}
/** Public interface for sending reply. */
+ @SuppressWarnings("UnknownNullness")
public interface Reply<T> {
void reply(T reply);
}
/** The codec used by JavaObjectFlutterApi. */
- static MessageCodec<Object> getCodec() {
+ static @NonNull MessageCodec<Object> getCodec() {
return new StandardMessageCodec();
}
- public void dispose(@NonNull Long identifierArg, Reply<Void> callback) {
+ public void dispose(@NonNull Long identifierArg, @NonNull Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger, "dev.flutter.pigeon.JavaObjectFlutterApi.dispose", getCodec());
@@ -569,19 +592,20 @@
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
public interface CookieManagerHostApi {
- void clearCookies(Result<Boolean> result);
+ void clearCookies(@NonNull Result<Boolean> result);
void setCookie(@NonNull String url, @NonNull String value);
/** The codec used by CookieManagerHostApi. */
- static MessageCodec<Object> getCodec() {
+ static @NonNull MessageCodec<Object> getCodec() {
return new StandardMessageCodec();
}
/**
* Sets up an instance of `CookieManagerHostApi` to handle messages through the
* `binaryMessenger`.
*/
- static void setup(BinaryMessenger binaryMessenger, CookieManagerHostApi api) {
+ static void setup(
+ @NonNull BinaryMessenger binaryMessenger, @Nullable CookieManagerHostApi api) {
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
@@ -592,25 +616,20 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
- try {
- Result<Boolean> resultCallback =
- new Result<Boolean>() {
- public void success(Boolean result) {
- wrapped.add(0, result);
- reply.reply(wrapped);
- }
+ Result<Boolean> resultCallback =
+ new Result<Boolean>() {
+ public void success(Boolean result) {
+ wrapped.add(0, result);
+ reply.reply(wrapped);
+ }
- public void error(Throwable error) {
- ArrayList<Object> wrappedError = wrapError(error);
- reply.reply(wrappedError);
- }
- };
+ public void error(Throwable error) {
+ ArrayList<Object> wrappedError = wrapError(error);
+ reply.reply(wrappedError);
+ }
+ };
- api.clearCookies(resultCallback);
- } catch (Error | RuntimeException exception) {
- ArrayList<Object> wrappedError = wrapError(exception);
- reply.reply(wrappedError);
- }
+ api.clearCookies(resultCallback);
});
} else {
channel.setMessageHandler(null);
@@ -624,20 +643,13 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ String urlArg = (String) args.get(0);
+ String valueArg = (String) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- String urlArg = (String) args.get(0);
- if (urlArg == null) {
- throw new NullPointerException("urlArg unexpectedly null.");
- }
- String valueArg = (String) args.get(1);
- if (valueArg == null) {
- throw new NullPointerException("valueArg unexpectedly null.");
- }
api.setCookie(urlArg, valueArg);
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -718,7 +730,7 @@
void clearCache(@NonNull Long instanceId, @NonNull Boolean includeDiskFiles);
void evaluateJavascript(
- @NonNull Long instanceId, @NonNull String javascriptString, Result<String> result);
+ @NonNull Long instanceId, @NonNull String javascriptString, @NonNull Result<String> result);
@Nullable
String getTitle(@NonNull Long instanceId);
@@ -752,11 +764,11 @@
void setBackgroundColor(@NonNull Long instanceId, @NonNull Long color);
/** The codec used by WebViewHostApi. */
- static MessageCodec<Object> getCodec() {
+ static @NonNull MessageCodec<Object> getCodec() {
return WebViewHostApiCodec.INSTANCE;
}
/** Sets up an instance of `WebViewHostApi` to handle messages through the `binaryMessenger`. */
- static void setup(BinaryMessenger binaryMessenger, WebViewHostApi api) {
+ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebViewHostApi api) {
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
@@ -765,16 +777,12 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
api.create((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -792,26 +800,19 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ String dataArg = (String) args.get(1);
+ String mimeTypeArg = (String) args.get(2);
+ String encodingArg = (String) args.get(3);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- String dataArg = (String) args.get(1);
- if (dataArg == null) {
- throw new NullPointerException("dataArg unexpectedly null.");
- }
- String mimeTypeArg = (String) args.get(2);
- String encodingArg = (String) args.get(3);
api.loadData(
(instanceIdArg == null) ? null : instanceIdArg.longValue(),
dataArg,
mimeTypeArg,
encodingArg);
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -831,21 +832,14 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ String baseUrlArg = (String) args.get(1);
+ String dataArg = (String) args.get(2);
+ String mimeTypeArg = (String) args.get(3);
+ String encodingArg = (String) args.get(4);
+ String historyUrlArg = (String) args.get(5);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- String baseUrlArg = (String) args.get(1);
- String dataArg = (String) args.get(2);
- if (dataArg == null) {
- throw new NullPointerException("dataArg unexpectedly null.");
- }
- String mimeTypeArg = (String) args.get(3);
- String encodingArg = (String) args.get(4);
- String historyUrlArg = (String) args.get(5);
api.loadDataWithBaseUrl(
(instanceIdArg == null) ? null : instanceIdArg.longValue(),
baseUrlArg,
@@ -854,7 +848,7 @@
encodingArg,
historyUrlArg);
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -872,27 +866,17 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ String urlArg = (String) args.get(1);
+ Map<String, String> headersArg = (Map<String, String>) args.get(2);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- String urlArg = (String) args.get(1);
- if (urlArg == null) {
- throw new NullPointerException("urlArg unexpectedly null.");
- }
- Map<String, String> headersArg = (Map<String, String>) args.get(2);
- if (headersArg == null) {
- throw new NullPointerException("headersArg unexpectedly null.");
- }
api.loadUrl(
(instanceIdArg == null) ? null : instanceIdArg.longValue(),
urlArg,
headersArg);
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -910,25 +894,15 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ String urlArg = (String) args.get(1);
+ byte[] dataArg = (byte[]) args.get(2);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- String urlArg = (String) args.get(1);
- if (urlArg == null) {
- throw new NullPointerException("urlArg unexpectedly null.");
- }
- byte[] dataArg = (byte[]) args.get(2);
- if (dataArg == null) {
- throw new NullPointerException("dataArg unexpectedly null.");
- }
api.postUrl(
(instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, dataArg);
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -946,17 +920,13 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
String output =
api.getUrl((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.add(0, output);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -974,17 +944,13 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
Boolean output =
api.canGoBack((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.add(0, output);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1002,17 +968,13 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
Boolean output =
api.canGoForward((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.add(0, output);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1030,16 +992,12 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
api.goBack((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1057,16 +1015,12 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
api.goForward((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1084,16 +1038,12 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
api.reload((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1111,22 +1061,15 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ Boolean includeDiskFilesArg = (Boolean) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- Boolean includeDiskFilesArg = (Boolean) args.get(1);
- if (includeDiskFilesArg == null) {
- throw new NullPointerException("includeDiskFilesArg unexpectedly null.");
- }
api.clearCache(
(instanceIdArg == null) ? null : instanceIdArg.longValue(),
includeDiskFilesArg);
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1146,38 +1089,26 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
- try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- String javascriptStringArg = (String) args.get(1);
- if (javascriptStringArg == null) {
- throw new NullPointerException("javascriptStringArg unexpectedly null.");
- }
- Result<String> resultCallback =
- new Result<String>() {
- public void success(String result) {
- wrapped.add(0, result);
- reply.reply(wrapped);
- }
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ String javascriptStringArg = (String) args.get(1);
+ Result<String> resultCallback =
+ new Result<String>() {
+ public void success(String result) {
+ wrapped.add(0, result);
+ reply.reply(wrapped);
+ }
- public void error(Throwable error) {
- ArrayList<Object> wrappedError = wrapError(error);
- reply.reply(wrappedError);
- }
- };
+ public void error(Throwable error) {
+ ArrayList<Object> wrappedError = wrapError(error);
+ reply.reply(wrappedError);
+ }
+ };
- api.evaluateJavascript(
- (instanceIdArg == null) ? null : instanceIdArg.longValue(),
- javascriptStringArg,
- resultCallback);
- } catch (Error | RuntimeException exception) {
- ArrayList<Object> wrappedError = wrapError(exception);
- reply.reply(wrappedError);
- }
+ api.evaluateJavascript(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(),
+ javascriptStringArg,
+ resultCallback);
});
} else {
channel.setMessageHandler(null);
@@ -1191,17 +1122,13 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
String output =
api.getTitle((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.add(0, output);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1219,27 +1146,17 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ Number xArg = (Number) args.get(1);
+ Number yArg = (Number) args.get(2);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- Number xArg = (Number) args.get(1);
- if (xArg == null) {
- throw new NullPointerException("xArg unexpectedly null.");
- }
- Number yArg = (Number) args.get(2);
- if (yArg == null) {
- throw new NullPointerException("yArg unexpectedly null.");
- }
api.scrollTo(
(instanceIdArg == null) ? null : instanceIdArg.longValue(),
(xArg == null) ? null : xArg.longValue(),
(yArg == null) ? null : yArg.longValue());
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1257,27 +1174,17 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ Number xArg = (Number) args.get(1);
+ Number yArg = (Number) args.get(2);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- Number xArg = (Number) args.get(1);
- if (xArg == null) {
- throw new NullPointerException("xArg unexpectedly null.");
- }
- Number yArg = (Number) args.get(2);
- if (yArg == null) {
- throw new NullPointerException("yArg unexpectedly null.");
- }
api.scrollBy(
(instanceIdArg == null) ? null : instanceIdArg.longValue(),
(xArg == null) ? null : xArg.longValue(),
(yArg == null) ? null : yArg.longValue());
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1295,17 +1202,13 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
Long output =
api.getScrollX((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.add(0, output);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1323,17 +1226,13 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
Long output =
api.getScrollY((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.add(0, output);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1351,18 +1250,14 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
WebViewPoint output =
api.getScrollPosition(
(instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.add(0, output);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1382,16 +1277,12 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Boolean enabledArg = (Boolean) args.get(0);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Boolean enabledArg = (Boolean) args.get(0);
- if (enabledArg == null) {
- throw new NullPointerException("enabledArg unexpectedly null.");
- }
api.setWebContentsDebuggingEnabled(enabledArg);
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1409,24 +1300,17 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ Number webViewClientInstanceIdArg = (Number) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- Number webViewClientInstanceIdArg = (Number) args.get(1);
- if (webViewClientInstanceIdArg == null) {
- throw new NullPointerException("webViewClientInstanceIdArg unexpectedly null.");
- }
api.setWebViewClient(
(instanceIdArg == null) ? null : instanceIdArg.longValue(),
(webViewClientInstanceIdArg == null)
? null
: webViewClientInstanceIdArg.longValue());
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1446,25 +1330,17 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ Number javaScriptChannelInstanceIdArg = (Number) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- Number javaScriptChannelInstanceIdArg = (Number) args.get(1);
- if (javaScriptChannelInstanceIdArg == null) {
- throw new NullPointerException(
- "javaScriptChannelInstanceIdArg unexpectedly null.");
- }
api.addJavaScriptChannel(
(instanceIdArg == null) ? null : instanceIdArg.longValue(),
(javaScriptChannelInstanceIdArg == null)
? null
: javaScriptChannelInstanceIdArg.longValue());
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1484,25 +1360,17 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ Number javaScriptChannelInstanceIdArg = (Number) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- Number javaScriptChannelInstanceIdArg = (Number) args.get(1);
- if (javaScriptChannelInstanceIdArg == null) {
- throw new NullPointerException(
- "javaScriptChannelInstanceIdArg unexpectedly null.");
- }
api.removeJavaScriptChannel(
(instanceIdArg == null) ? null : instanceIdArg.longValue(),
(javaScriptChannelInstanceIdArg == null)
? null
: javaScriptChannelInstanceIdArg.longValue());
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1522,19 +1390,15 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ Number listenerInstanceIdArg = (Number) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- Number listenerInstanceIdArg = (Number) args.get(1);
api.setDownloadListener(
(instanceIdArg == null) ? null : instanceIdArg.longValue(),
(listenerInstanceIdArg == null) ? null : listenerInstanceIdArg.longValue());
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1554,19 +1418,15 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ Number clientInstanceIdArg = (Number) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- Number clientInstanceIdArg = (Number) args.get(1);
api.setWebChromeClient(
(instanceIdArg == null) ? null : instanceIdArg.longValue(),
(clientInstanceIdArg == null) ? null : clientInstanceIdArg.longValue());
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1586,22 +1446,15 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ Number colorArg = (Number) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- Number colorArg = (Number) args.get(1);
- if (colorArg == null) {
- throw new NullPointerException("colorArg unexpectedly null.");
- }
api.setBackgroundColor(
(instanceIdArg == null) ? null : instanceIdArg.longValue(),
(colorArg == null) ? null : colorArg.longValue());
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1624,22 +1477,23 @@
* <p>Generated class from Pigeon that represents Flutter messages that can be called from Java.
*/
public static class WebViewFlutterApi {
- private final BinaryMessenger binaryMessenger;
+ private final @NonNull BinaryMessenger binaryMessenger;
- public WebViewFlutterApi(BinaryMessenger argBinaryMessenger) {
+ public WebViewFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) {
this.binaryMessenger = argBinaryMessenger;
}
/** Public interface for sending reply. */
+ @SuppressWarnings("UnknownNullness")
public interface Reply<T> {
void reply(T reply);
}
/** The codec used by WebViewFlutterApi. */
- static MessageCodec<Object> getCodec() {
+ static @NonNull MessageCodec<Object> getCodec() {
return new StandardMessageCodec();
}
/** Create a new Dart instance and add it to the `InstanceManager`. */
- public void create(@NonNull Long identifierArg, Reply<Void> callback) {
+ public void create(@NonNull Long identifierArg, @NonNull Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger, "dev.flutter.pigeon.WebViewFlutterApi.create", getCodec());
@@ -1680,13 +1534,13 @@
void setTextZoom(@NonNull Long instanceId, @NonNull Long textZoom);
/** The codec used by WebSettingsHostApi. */
- static MessageCodec<Object> getCodec() {
+ static @NonNull MessageCodec<Object> getCodec() {
return new StandardMessageCodec();
}
/**
* Sets up an instance of `WebSettingsHostApi` to handle messages through the `binaryMessenger`.
*/
- static void setup(BinaryMessenger binaryMessenger, WebSettingsHostApi api) {
+ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebSettingsHostApi api) {
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
@@ -1695,22 +1549,15 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ Number webViewInstanceIdArg = (Number) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- Number webViewInstanceIdArg = (Number) args.get(1);
- if (webViewInstanceIdArg == null) {
- throw new NullPointerException("webViewInstanceIdArg unexpectedly null.");
- }
api.create(
(instanceIdArg == null) ? null : instanceIdArg.longValue(),
(webViewInstanceIdArg == null) ? null : webViewInstanceIdArg.longValue());
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1730,21 +1577,14 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ Boolean flagArg = (Boolean) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- Boolean flagArg = (Boolean) args.get(1);
- if (flagArg == null) {
- throw new NullPointerException("flagArg unexpectedly null.");
- }
api.setDomStorageEnabled(
(instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg);
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1764,21 +1604,14 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ Boolean flagArg = (Boolean) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- Boolean flagArg = (Boolean) args.get(1);
- if (flagArg == null) {
- throw new NullPointerException("flagArg unexpectedly null.");
- }
api.setJavaScriptCanOpenWindowsAutomatically(
(instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg);
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1798,21 +1631,14 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ Boolean supportArg = (Boolean) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- Boolean supportArg = (Boolean) args.get(1);
- if (supportArg == null) {
- throw new NullPointerException("supportArg unexpectedly null.");
- }
api.setSupportMultipleWindows(
(instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg);
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1832,21 +1658,14 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ Boolean flagArg = (Boolean) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- Boolean flagArg = (Boolean) args.get(1);
- if (flagArg == null) {
- throw new NullPointerException("flagArg unexpectedly null.");
- }
api.setJavaScriptEnabled(
(instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg);
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1866,19 +1685,15 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ String userAgentStringArg = (String) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- String userAgentStringArg = (String) args.get(1);
api.setUserAgentString(
(instanceIdArg == null) ? null : instanceIdArg.longValue(),
userAgentStringArg);
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1898,21 +1713,14 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ Boolean requireArg = (Boolean) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- Boolean requireArg = (Boolean) args.get(1);
- if (requireArg == null) {
- throw new NullPointerException("requireArg unexpectedly null.");
- }
api.setMediaPlaybackRequiresUserGesture(
(instanceIdArg == null) ? null : instanceIdArg.longValue(), requireArg);
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1932,21 +1740,14 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ Boolean supportArg = (Boolean) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- Boolean supportArg = (Boolean) args.get(1);
- if (supportArg == null) {
- throw new NullPointerException("supportArg unexpectedly null.");
- }
api.setSupportZoom(
(instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg);
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -1966,21 +1767,14 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ Boolean overviewArg = (Boolean) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- Boolean overviewArg = (Boolean) args.get(1);
- if (overviewArg == null) {
- throw new NullPointerException("overviewArg unexpectedly null.");
- }
api.setLoadWithOverviewMode(
(instanceIdArg == null) ? null : instanceIdArg.longValue(), overviewArg);
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -2000,21 +1794,14 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ Boolean useArg = (Boolean) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- Boolean useArg = (Boolean) args.get(1);
- if (useArg == null) {
- throw new NullPointerException("useArg unexpectedly null.");
- }
api.setUseWideViewPort(
(instanceIdArg == null) ? null : instanceIdArg.longValue(), useArg);
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -2034,21 +1821,14 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ Boolean enabledArg = (Boolean) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- Boolean enabledArg = (Boolean) args.get(1);
- if (enabledArg == null) {
- throw new NullPointerException("enabledArg unexpectedly null.");
- }
api.setDisplayZoomControls(
(instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg);
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -2068,21 +1848,14 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ Boolean enabledArg = (Boolean) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- Boolean enabledArg = (Boolean) args.get(1);
- if (enabledArg == null) {
- throw new NullPointerException("enabledArg unexpectedly null.");
- }
api.setBuiltInZoomControls(
(instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg);
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -2102,21 +1875,14 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ Boolean enabledArg = (Boolean) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- Boolean enabledArg = (Boolean) args.get(1);
- if (enabledArg == null) {
- throw new NullPointerException("enabledArg unexpectedly null.");
- }
api.setAllowFileAccess(
(instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg);
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -2134,22 +1900,15 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ Number textZoomArg = (Number) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- Number textZoomArg = (Number) args.get(1);
- if (textZoomArg == null) {
- throw new NullPointerException("textZoomArg unexpectedly null.");
- }
api.setTextZoom(
(instanceIdArg == null) ? null : instanceIdArg.longValue(),
(textZoomArg == null) ? null : textZoomArg.longValue());
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -2167,14 +1926,15 @@
void create(@NonNull Long instanceId, @NonNull String channelName);
/** The codec used by JavaScriptChannelHostApi. */
- static MessageCodec<Object> getCodec() {
+ static @NonNull MessageCodec<Object> getCodec() {
return new StandardMessageCodec();
}
/**
* Sets up an instance of `JavaScriptChannelHostApi` to handle messages through the
* `binaryMessenger`.
*/
- static void setup(BinaryMessenger binaryMessenger, JavaScriptChannelHostApi api) {
+ static void setup(
+ @NonNull BinaryMessenger binaryMessenger, @Nullable JavaScriptChannelHostApi api) {
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
@@ -2183,21 +1943,14 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ String channelNameArg = (String) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- String channelNameArg = (String) args.get(1);
- if (channelNameArg == null) {
- throw new NullPointerException("channelNameArg unexpectedly null.");
- }
api.create(
(instanceIdArg == null) ? null : instanceIdArg.longValue(), channelNameArg);
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -2211,23 +1964,24 @@
}
/** Generated class from Pigeon that represents Flutter messages that can be called from Java. */
public static class JavaScriptChannelFlutterApi {
- private final BinaryMessenger binaryMessenger;
+ private final @NonNull BinaryMessenger binaryMessenger;
- public JavaScriptChannelFlutterApi(BinaryMessenger argBinaryMessenger) {
+ public JavaScriptChannelFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) {
this.binaryMessenger = argBinaryMessenger;
}
/** Public interface for sending reply. */
+ @SuppressWarnings("UnknownNullness")
public interface Reply<T> {
void reply(T reply);
}
/** The codec used by JavaScriptChannelFlutterApi. */
- static MessageCodec<Object> getCodec() {
+ static @NonNull MessageCodec<Object> getCodec() {
return new StandardMessageCodec();
}
public void postMessage(
- @NonNull Long instanceIdArg, @NonNull String messageArg, Reply<Void> callback) {
+ @NonNull Long instanceIdArg, @NonNull String messageArg, @NonNull Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger,
@@ -2247,14 +2001,15 @@
@NonNull Long instanceId, @NonNull Boolean value);
/** The codec used by WebViewClientHostApi. */
- static MessageCodec<Object> getCodec() {
+ static @NonNull MessageCodec<Object> getCodec() {
return new StandardMessageCodec();
}
/**
* Sets up an instance of `WebViewClientHostApi` to handle messages through the
* `binaryMessenger`.
*/
- static void setup(BinaryMessenger binaryMessenger, WebViewClientHostApi api) {
+ static void setup(
+ @NonNull BinaryMessenger binaryMessenger, @Nullable WebViewClientHostApi api) {
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
@@ -2263,16 +2018,12 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
api.create((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -2292,21 +2043,14 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ Boolean valueArg = (Boolean) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- Boolean valueArg = (Boolean) args.get(1);
- if (valueArg == null) {
- throw new NullPointerException("valueArg unexpectedly null.");
- }
api.setSynchronousReturnValueForShouldOverrideUrlLoading(
(instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg);
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -2352,18 +2096,19 @@
/** Generated class from Pigeon that represents Flutter messages that can be called from Java. */
public static class WebViewClientFlutterApi {
- private final BinaryMessenger binaryMessenger;
+ private final @NonNull BinaryMessenger binaryMessenger;
- public WebViewClientFlutterApi(BinaryMessenger argBinaryMessenger) {
+ public WebViewClientFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) {
this.binaryMessenger = argBinaryMessenger;
}
/** Public interface for sending reply. */
+ @SuppressWarnings("UnknownNullness")
public interface Reply<T> {
void reply(T reply);
}
/** The codec used by WebViewClientFlutterApi. */
- static MessageCodec<Object> getCodec() {
+ static @NonNull MessageCodec<Object> getCodec() {
return WebViewClientFlutterApiCodec.INSTANCE;
}
@@ -2371,7 +2116,7 @@
@NonNull Long instanceIdArg,
@NonNull Long webViewInstanceIdArg,
@NonNull String urlArg,
- Reply<Void> callback) {
+ @NonNull Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger,
@@ -2386,7 +2131,7 @@
@NonNull Long instanceIdArg,
@NonNull Long webViewInstanceIdArg,
@NonNull String urlArg,
- Reply<Void> callback) {
+ @NonNull Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger,
@@ -2402,7 +2147,7 @@
@NonNull Long webViewInstanceIdArg,
@NonNull WebResourceRequestData requestArg,
@NonNull WebResourceErrorData errorArg,
- Reply<Void> callback) {
+ @NonNull Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger,
@@ -2420,7 +2165,7 @@
@NonNull Long errorCodeArg,
@NonNull String descriptionArg,
@NonNull String failingUrlArg,
- Reply<Void> callback) {
+ @NonNull Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger,
@@ -2441,7 +2186,7 @@
@NonNull Long instanceIdArg,
@NonNull Long webViewInstanceIdArg,
@NonNull WebResourceRequestData requestArg,
- Reply<Void> callback) {
+ @NonNull Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger,
@@ -2456,7 +2201,7 @@
@NonNull Long instanceIdArg,
@NonNull Long webViewInstanceIdArg,
@NonNull String urlArg,
- Reply<Void> callback) {
+ @NonNull Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading", getCodec());
@@ -2464,6 +2209,23 @@
new ArrayList<Object>(Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg)),
channelReply -> callback.reply(null));
}
+
+ public void doUpdateVisitedHistory(
+ @NonNull Long instanceIdArg,
+ @NonNull Long webViewInstanceIdArg,
+ @NonNull String urlArg,
+ @NonNull Boolean isReloadArg,
+ @NonNull Reply<Void> callback) {
+ BasicMessageChannel<Object> channel =
+ new BasicMessageChannel<>(
+ binaryMessenger,
+ "dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory",
+ getCodec());
+ channel.send(
+ new ArrayList<Object>(
+ Arrays.asList(instanceIdArg, webViewInstanceIdArg, urlArg, isReloadArg)),
+ channelReply -> callback.reply(null));
+ }
}
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
public interface DownloadListenerHostApi {
@@ -2471,14 +2233,15 @@
void create(@NonNull Long instanceId);
/** The codec used by DownloadListenerHostApi. */
- static MessageCodec<Object> getCodec() {
+ static @NonNull MessageCodec<Object> getCodec() {
return new StandardMessageCodec();
}
/**
* Sets up an instance of `DownloadListenerHostApi` to handle messages through the
* `binaryMessenger`.
*/
- static void setup(BinaryMessenger binaryMessenger, DownloadListenerHostApi api) {
+ static void setup(
+ @NonNull BinaryMessenger binaryMessenger, @Nullable DownloadListenerHostApi api) {
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
@@ -2487,16 +2250,12 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
api.create((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -2510,18 +2269,19 @@
}
/** Generated class from Pigeon that represents Flutter messages that can be called from Java. */
public static class DownloadListenerFlutterApi {
- private final BinaryMessenger binaryMessenger;
+ private final @NonNull BinaryMessenger binaryMessenger;
- public DownloadListenerFlutterApi(BinaryMessenger argBinaryMessenger) {
+ public DownloadListenerFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) {
this.binaryMessenger = argBinaryMessenger;
}
/** Public interface for sending reply. */
+ @SuppressWarnings("UnknownNullness")
public interface Reply<T> {
void reply(T reply);
}
/** The codec used by DownloadListenerFlutterApi. */
- static MessageCodec<Object> getCodec() {
+ static @NonNull MessageCodec<Object> getCodec() {
return new StandardMessageCodec();
}
@@ -2532,7 +2292,7 @@
@NonNull String contentDispositionArg,
@NonNull String mimetypeArg,
@NonNull Long contentLengthArg,
- Reply<Void> callback) {
+ @NonNull Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger,
@@ -2559,14 +2319,15 @@
@NonNull Long instanceId, @NonNull Boolean value);
/** The codec used by WebChromeClientHostApi. */
- static MessageCodec<Object> getCodec() {
+ static @NonNull MessageCodec<Object> getCodec() {
return new StandardMessageCodec();
}
/**
* Sets up an instance of `WebChromeClientHostApi` to handle messages through the
* `binaryMessenger`.
*/
- static void setup(BinaryMessenger binaryMessenger, WebChromeClientHostApi api) {
+ static void setup(
+ @NonNull BinaryMessenger binaryMessenger, @Nullable WebChromeClientHostApi api) {
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
@@ -2575,16 +2336,12 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
api.create((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -2604,21 +2361,14 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
+ Boolean valueArg = (Boolean) args.get(1);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
- Boolean valueArg = (Boolean) args.get(1);
- if (valueArg == null) {
- throw new NullPointerException("valueArg unexpectedly null.");
- }
api.setSynchronousReturnValueForOnShowFileChooser(
(instanceIdArg == null) ? null : instanceIdArg.longValue(), valueArg);
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -2640,14 +2390,15 @@
String getAssetFilePathByName(@NonNull String name);
/** The codec used by FlutterAssetManagerHostApi. */
- static MessageCodec<Object> getCodec() {
+ static @NonNull MessageCodec<Object> getCodec() {
return new StandardMessageCodec();
}
/**
* Sets up an instance of `FlutterAssetManagerHostApi` to handle messages through the
* `binaryMessenger`.
*/
- static void setup(BinaryMessenger binaryMessenger, FlutterAssetManagerHostApi api) {
+ static void setup(
+ @NonNull BinaryMessenger binaryMessenger, @Nullable FlutterAssetManagerHostApi api) {
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
@@ -2656,16 +2407,12 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ String pathArg = (String) args.get(0);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- String pathArg = (String) args.get(0);
- if (pathArg == null) {
- throw new NullPointerException("pathArg unexpectedly null.");
- }
List<String> output = api.list(pathArg);
wrapped.add(0, output);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -2685,16 +2432,12 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ String nameArg = (String) args.get(0);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- String nameArg = (String) args.get(0);
- if (nameArg == null) {
- throw new NullPointerException("nameArg unexpectedly null.");
- }
String output = api.getAssetFilePathByName(nameArg);
wrapped.add(0, output);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -2708,18 +2451,19 @@
}
/** Generated class from Pigeon that represents Flutter messages that can be called from Java. */
public static class WebChromeClientFlutterApi {
- private final BinaryMessenger binaryMessenger;
+ private final @NonNull BinaryMessenger binaryMessenger;
- public WebChromeClientFlutterApi(BinaryMessenger argBinaryMessenger) {
+ public WebChromeClientFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) {
this.binaryMessenger = argBinaryMessenger;
}
/** Public interface for sending reply. */
+ @SuppressWarnings("UnknownNullness")
public interface Reply<T> {
void reply(T reply);
}
/** The codec used by WebChromeClientFlutterApi. */
- static MessageCodec<Object> getCodec() {
+ static @NonNull MessageCodec<Object> getCodec() {
return new StandardMessageCodec();
}
@@ -2727,7 +2471,7 @@
@NonNull Long instanceIdArg,
@NonNull Long webViewInstanceIdArg,
@NonNull Long progressArg,
- Reply<Void> callback) {
+ @NonNull Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger,
@@ -2742,7 +2486,7 @@
@NonNull Long instanceIdArg,
@NonNull Long webViewInstanceIdArg,
@NonNull Long paramsInstanceIdArg,
- Reply<List<String>> callback) {
+ @NonNull Reply<List<String>> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger,
@@ -2766,13 +2510,13 @@
void deleteAllData(@NonNull Long instanceId);
/** The codec used by WebStorageHostApi. */
- static MessageCodec<Object> getCodec() {
+ static @NonNull MessageCodec<Object> getCodec() {
return new StandardMessageCodec();
}
/**
* Sets up an instance of `WebStorageHostApi` to handle messages through the `binaryMessenger`.
*/
- static void setup(BinaryMessenger binaryMessenger, WebStorageHostApi api) {
+ static void setup(@NonNull BinaryMessenger binaryMessenger, @Nullable WebStorageHostApi api) {
{
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
@@ -2781,16 +2525,12 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
api.create((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -2808,16 +2548,12 @@
channel.setMessageHandler(
(message, reply) -> {
ArrayList<Object> wrapped = new ArrayList<Object>();
+ ArrayList<Object> args = (ArrayList<Object>) message;
+ Number instanceIdArg = (Number) args.get(0);
try {
- ArrayList<Object> args = (ArrayList<Object>) message;
- assert args != null;
- Number instanceIdArg = (Number) args.get(0);
- if (instanceIdArg == null) {
- throw new NullPointerException("instanceIdArg unexpectedly null.");
- }
api.deleteAllData((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.add(0, null);
- } catch (Error | RuntimeException exception) {
+ } catch (Throwable exception) {
ArrayList<Object> wrappedError = wrapError(exception);
wrapped = wrappedError;
}
@@ -2866,18 +2602,19 @@
* <p>Generated class from Pigeon that represents Flutter messages that can be called from Java.
*/
public static class FileChooserParamsFlutterApi {
- private final BinaryMessenger binaryMessenger;
+ private final @NonNull BinaryMessenger binaryMessenger;
- public FileChooserParamsFlutterApi(BinaryMessenger argBinaryMessenger) {
+ public FileChooserParamsFlutterApi(@NonNull BinaryMessenger argBinaryMessenger) {
this.binaryMessenger = argBinaryMessenger;
}
/** Public interface for sending reply. */
+ @SuppressWarnings("UnknownNullness")
public interface Reply<T> {
void reply(T reply);
}
/** The codec used by FileChooserParamsFlutterApi. */
- static MessageCodec<Object> getCodec() {
+ static @NonNull MessageCodec<Object> getCodec() {
return FileChooserParamsFlutterApiCodec.INSTANCE;
}
@@ -2887,7 +2624,7 @@
@NonNull List<String> acceptTypesArg,
@NonNull FileChooserModeEnumData modeArg,
@Nullable String filenameHintArg,
- Reply<Void> callback) {
+ @NonNull Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger, "dev.flutter.pigeon.FileChooserParamsFlutterApi.create", getCodec());
diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientFlutterApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientFlutterApiImpl.java
index aad569d..6893af9 100644
--- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientFlutterApiImpl.java
+++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientFlutterApiImpl.java
@@ -10,6 +10,7 @@
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;
+import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.webkit.WebResourceErrorCompat;
import io.flutter.plugin.common.BinaryMessenger;
@@ -202,6 +203,21 @@
urlLoading(getIdentifierForClient(webViewClient), webViewIdentifier, urlArg, callback);
}
+ /** Passes arguments from {@link WebViewClient#doUpdateVisitedHistory} to Dart. */
+ public void doUpdateVisitedHistory(
+ @NonNull WebViewClient webViewClient,
+ @NonNull WebView webView,
+ @NonNull String url,
+ boolean isReload,
+ @NonNull Reply<Void> callback) {
+ webViewFlutterApi.create(webView, reply -> {});
+
+ final Long webViewIdentifier =
+ Objects.requireNonNull(instanceManager.getIdentifierForStrongReference(webView));
+ doUpdateVisitedHistory(
+ getIdentifierForClient(webViewClient), webViewIdentifier, url, isReload, callback);
+ }
+
private long getIdentifierForClient(WebViewClient webViewClient) {
final Long identifier = instanceManager.getIdentifierForStrongReference(webViewClient);
if (identifier == null) {
diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientHostApiImpl.java
index 79c0210..b5764f4 100644
--- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientHostApiImpl.java
+++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewClientHostApiImpl.java
@@ -83,6 +83,11 @@
}
@Override
+ public void doUpdateVisitedHistory(WebView view, String url, boolean isReload) {
+ flutterApi.doUpdateVisitedHistory(this, view, url, isReload, reply -> {});
+ }
+
+ @Override
public void onUnhandledKeyEvent(WebView view, KeyEvent event) {
// Deliberately empty. Occasionally the webview will mark events as having failed to be
// handled even though they were handled. We don't want to propagate those as they're not
@@ -155,7 +160,12 @@
}
@Override
- public void onUnhandledKeyEvent(WebView view, KeyEvent event) {
+ public void doUpdateVisitedHistory(WebView view, String url, boolean isReload) {
+ flutterApi.doUpdateVisitedHistory(this, view, url, isReload, reply -> {});
+ }
+
+ @Override
+ public void onUnhandledKeyEvent(@NonNull WebView view, @NonNull KeyEvent event) {
// Deliberately empty. Occasionally the webview will mark events as having failed to be
// handled even though they were handled. We don't want to propagate those as they're not
// truly lost.
@@ -175,7 +185,8 @@
* @param flutterApi handles sending messages to Dart
* @return the created {@link WebViewClient}
*/
- public WebViewClient createWebViewClient(WebViewClientFlutterApiImpl flutterApi) {
+ @NonNull
+ public WebViewClient createWebViewClient(@NonNull WebViewClientFlutterApiImpl flutterApi) {
// WebViewClientCompat is used to get
// shouldOverrideUrlLoading(WebView view, WebResourceRequest request)
// invoked by the webview on older Android devices, without it pages that use iframes will
diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewClientTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewClientTest.java
index f9e836e..2462ef3 100644
--- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewClientTest.java
+++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewClientTest.java
@@ -15,6 +15,7 @@
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;
+import androidx.annotation.NonNull;
import io.flutter.plugins.webviewflutter.WebViewClientHostApiImpl.WebViewClientCompatImpl;
import io.flutter.plugins.webviewflutter.WebViewClientHostApiImpl.WebViewClientCreator;
import java.util.HashMap;
@@ -111,8 +112,10 @@
new WebViewClientHostApiImpl(
instanceManager,
new WebViewClientCreator() {
+ @NonNull
@Override
- public WebViewClient createWebViewClient(WebViewClientFlutterApiImpl flutterApi) {
+ public WebViewClient createWebViewClient(
+ @NonNull WebViewClientFlutterApiImpl flutterApi) {
return mockWebViewClient;
}
},
@@ -123,4 +126,12 @@
verify(mockWebViewClient).setReturnValueForShouldOverrideUrlLoading(false);
}
+
+ @Test
+ public void doUpdateVisitedHistory() {
+ webViewClient.doUpdateVisitedHistory(mockWebView, "https://www.google.com", true);
+ verify(mockFlutterApi)
+ .doUpdateVisitedHistory(
+ eq(webViewClient), eq(mockWebView), eq("https://www.google.com"), eq(true), any());
+ }
}
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 4ec7ae8..188687b 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
@@ -942,6 +942,81 @@
final String? currentUrl = await controller.currentUrl();
expect(currentUrl, secondaryUrl);
});
+
+ testWidgets('can receive url changes', (WidgetTester tester) async {
+ final Completer<void> pageLoaded = Completer<void>();
+
+ final PlatformNavigationDelegate navigationDelegate =
+ PlatformNavigationDelegate(
+ const PlatformNavigationDelegateCreationParams(),
+ )..setOnPageFinished((_) => pageLoaded.complete());
+
+ final PlatformWebViewController controller = PlatformWebViewController(
+ const PlatformWebViewControllerCreationParams(),
+ )
+ ..setJavaScriptMode(JavaScriptMode.unrestricted)
+ ..setPlatformNavigationDelegate(navigationDelegate)
+ ..loadRequest(LoadRequestParams(uri: Uri.parse(blankPageEncoded)));
+
+ await tester.pumpWidget(Builder(
+ builder: (BuildContext context) {
+ return PlatformWebViewWidget(
+ PlatformWebViewWidgetCreationParams(controller: controller),
+ ).build(context);
+ },
+ ));
+
+ await pageLoaded.future;
+ await navigationDelegate.setOnPageFinished((_) {});
+
+ final Completer<String> urlChangeCompleter = Completer<String>();
+ await navigationDelegate.setOnUrlChange((UrlChange change) {
+ urlChangeCompleter.complete(change.url);
+ });
+
+ await controller.runJavaScript('location.href = "$primaryUrl"');
+
+ await expectLater(urlChangeCompleter.future, completion(primaryUrl));
+ });
+
+ testWidgets('can receive updates to history state',
+ (WidgetTester tester) async {
+ final Completer<void> pageLoaded = Completer<void>();
+
+ final PlatformNavigationDelegate navigationDelegate =
+ PlatformNavigationDelegate(
+ const PlatformNavigationDelegateCreationParams(),
+ )..setOnPageFinished((_) => pageLoaded.complete());
+
+ final PlatformWebViewController controller = PlatformWebViewController(
+ const PlatformWebViewControllerCreationParams(),
+ )
+ ..setJavaScriptMode(JavaScriptMode.unrestricted)
+ ..setPlatformNavigationDelegate(navigationDelegate)
+ ..loadRequest(LoadRequestParams(uri: Uri.parse(primaryUrl)));
+
+ await tester.pumpWidget(Builder(
+ builder: (BuildContext context) {
+ return PlatformWebViewWidget(
+ PlatformWebViewWidgetCreationParams(controller: controller),
+ ).build(context);
+ },
+ ));
+
+ await pageLoaded.future;
+ await navigationDelegate.setOnPageFinished((_) {});
+
+ final Completer<String> urlChangeCompleter = Completer<String>();
+ await navigationDelegate.setOnUrlChange((UrlChange change) {
+ urlChangeCompleter.complete(change.url);
+ });
+
+ await controller.runJavaScript(
+ 'window.history.pushState({}, "", "secondary.txt");',
+ );
+
+ await expectLater(urlChangeCompleter.future, completion(secondaryUrl));
+ });
});
testWidgets('target _blank opens in same window',
diff --git a/packages/webview_flutter/webview_flutter_android/example/lib/main.dart b/packages/webview_flutter/webview_flutter_android/example/lib/main.dart
index 3c6a514..b8c9f7b 100644
--- a/packages/webview_flutter/webview_flutter_android/example/lib/main.dart
+++ b/packages/webview_flutter/webview_flutter_android/example/lib/main.dart
@@ -123,6 +123,9 @@
}
debugPrint('allowing navigation to ${request.url}');
return NavigationDecision.navigate;
+ })
+ ..setOnUrlChange((UrlChange change) {
+ debugPrint('url change to ${change.url}');
}),
)
..addJavaScriptChannel(JavaScriptChannelParams(
diff --git a/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml
index 83f3f00..8a190ff 100644
--- a/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml
+++ b/packages/webview_flutter/webview_flutter_android/example/pubspec.yaml
@@ -19,7 +19,7 @@
# The example app is bundled with the plugin so we use a path dependency on
# the parent directory to use the current plugin's version.
path: ../
- webview_flutter_platform_interface: ^2.0.0
+ webview_flutter_platform_interface: ^2.1.0
dev_dependencies:
espresso: ^0.2.0
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 a6505c2..0d71622 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
@@ -58,6 +58,8 @@
android_webview.WebResourceRequest request,
)? requestLoading,
void Function(android_webview.WebView webView, String url)? urlLoading,
+ void Function(android_webview.WebView webView, String url, bool isReload)?
+ doUpdateVisitedHistory,
}) createAndroidWebViewClient;
/// Constructs a [android_webview.FlutterAssetManager].
diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart
index 5c55209..8ab89d4 100644
--- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart
+++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.dart
@@ -677,6 +677,7 @@
@Deprecated('Only called on Android version < 23.') this.onReceivedError,
this.requestLoading,
this.urlLoading,
+ this.doUpdateVisitedHistory,
@visibleForTesting super.binaryMessenger,
@visibleForTesting super.instanceManager,
}) : super.detached() {
@@ -696,6 +697,7 @@
@Deprecated('Only called on Android version < 23.') this.onReceivedError,
this.requestLoading,
this.urlLoading,
+ this.doUpdateVisitedHistory,
super.binaryMessenger,
super.instanceManager,
}) : super.detached();
@@ -840,6 +842,10 @@
/// indicates whether the [WebView] loaded the URL.
final void Function(WebView webView, String url)? urlLoading;
+ /// Notify the host application to update its visited links database.
+ final void Function(WebView webView, String url, bool isReload)?
+ doUpdateVisitedHistory;
+
/// Sets the required synchronous return value for the Java method,
/// `WebViewClient.shouldOverrideUrlLoading(...)`.
///
@@ -867,6 +873,7 @@
onReceivedError: onReceivedError,
requestLoading: requestLoading,
urlLoading: urlLoading,
+ doUpdateVisitedHistory: doUpdateVisitedHistory,
binaryMessenger: _api.binaryMessenger,
instanceManager: _api.instanceManager,
);
diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart
index d2976a8..6529284 100644
--- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart
+++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.g.dart
@@ -1,7 +1,7 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Autogenerated from Pigeon (v9.0.5), do not edit directly.
+// Autogenerated from Pigeon (v9.2.3), do not edit directly.
// See also: https://pub.dev/packages/pigeon
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, prefer_null_aware_operators, omit_local_variable_types, unused_shown_name, unnecessary_import
@@ -1514,6 +1514,9 @@
void urlLoading(int instanceId, int webViewInstanceId, String url);
+ void doUpdateVisitedHistory(
+ int instanceId, int webViewInstanceId, String url, bool isReload);
+
static void setup(WebViewClientFlutterApi? api,
{BinaryMessenger? binaryMessenger}) {
{
@@ -1682,6 +1685,36 @@
});
}
}
+ {
+ final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory',
+ codec,
+ binaryMessenger: binaryMessenger);
+ if (api == null) {
+ channel.setMessageHandler(null);
+ } else {
+ channel.setMessageHandler((Object? message) async {
+ assert(message != null,
+ 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null.');
+ final List<Object?> args = (message as List<Object?>?)!;
+ final int? arg_instanceId = (args[0] as int?);
+ assert(arg_instanceId != null,
+ 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null, expected non-null int.');
+ final int? arg_webViewInstanceId = (args[1] as int?);
+ assert(arg_webViewInstanceId != null,
+ 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null, expected non-null int.');
+ final String? arg_url = (args[2] as String?);
+ assert(arg_url != null,
+ 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null, expected non-null String.');
+ final bool? arg_isReload = (args[3] as bool?);
+ assert(arg_isReload != null,
+ 'Argument for dev.flutter.pigeon.WebViewClientFlutterApi.doUpdateVisitedHistory was null, expected non-null bool.');
+ api.doUpdateVisitedHistory(
+ arg_instanceId!, arg_webViewInstanceId!, arg_url!, arg_isReload!);
+ 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 721caf7..0bc2c84 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
@@ -754,6 +754,30 @@
instance.urlLoading!(webViewInstance!, url);
}
}
+
+ @override
+ void doUpdateVisitedHistory(
+ int instanceId,
+ int webViewInstanceId,
+ String url,
+ bool isReload,
+ ) {
+ final WebViewClient? instance = instanceManager
+ .getInstanceWithWeakReference(instanceId) as WebViewClient?;
+ final WebView? webViewInstance = instanceManager
+ .getInstanceWithWeakReference(webViewInstanceId) as WebView?;
+ assert(
+ instance != null,
+ 'InstanceManager does not contain an WebViewClient with instanceId: $instanceId',
+ );
+ assert(
+ webViewInstance != null,
+ 'InstanceManager does not contain an WebView with instanceId: $webViewInstanceId',
+ );
+ if (instance!.doUpdateVisitedHistory != null) {
+ instance.doUpdateVisitedHistory!(webViewInstance!, url, isReload);
+ }
+ }
}
/// Host api implementation for [DownloadListener].
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 f1fe168..88a4bca 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
@@ -704,6 +704,15 @@
final AndroidWebViewProxy androidWebViewProxy;
}
+/// Android details of the change to a web view's url.
+class AndroidUrlChange extends UrlChange {
+ /// Constructs an [AndroidUrlChange].
+ const AndroidUrlChange({required super.url, required this.isReload});
+
+ /// Whether the url is being reloaded.
+ final bool isReload;
+}
+
/// A place to register callback methods responsible to handle navigation events
/// triggered by the [android_webview.WebView].
class AndroidNavigationDelegate extends PlatformNavigationDelegate {
@@ -720,13 +729,15 @@
.androidWebViewProxy
.createAndroidWebViewClient(
onPageFinished: (android_webview.WebView webView, String url) {
- if (weakThis.target?._onPageFinished != null) {
- weakThis.target!._onPageFinished!(url);
+ final PageEventCallback? callback = weakThis.target?._onPageFinished;
+ if (callback != null) {
+ callback(url);
}
},
onPageStarted: (android_webview.WebView webView, String url) {
- if (weakThis.target?._onPageStarted != null) {
- weakThis.target!._onPageStarted!(url);
+ final PageEventCallback? callback = weakThis.target?._onPageStarted;
+ if (callback != null) {
+ callback(url);
}
},
onReceivedRequestError: (
@@ -734,8 +745,10 @@
android_webview.WebResourceRequest request,
android_webview.WebResourceError error,
) {
- if (weakThis.target?._onWebResourceError != null) {
- weakThis.target!._onWebResourceError!(AndroidWebResourceError._(
+ final WebResourceErrorCallback? callback =
+ weakThis.target?._onWebResourceError;
+ if (callback != null) {
+ callback(AndroidWebResourceError._(
errorCode: error.errorCode,
description: error.description,
failingUrl: request.url,
@@ -749,8 +762,10 @@
String description,
String failingUrl,
) {
- if (weakThis.target?._onWebResourceError != null) {
- weakThis.target!._onWebResourceError!(AndroidWebResourceError._(
+ final WebResourceErrorCallback? callback =
+ weakThis.target?._onWebResourceError;
+ if (callback != null) {
+ callback(AndroidWebResourceError._(
errorCode: errorCode,
description: description,
failingUrl: failingUrl,
@@ -762,20 +777,23 @@
android_webview.WebView webView,
android_webview.WebResourceRequest request,
) {
- if (weakThis.target != null) {
- weakThis.target!._handleNavigation(
- request.url,
- headers: request.requestHeaders,
- isForMainFrame: request.isForMainFrame,
- );
- }
+ weakThis.target?._handleNavigation(
+ request.url,
+ headers: request.requestHeaders,
+ isForMainFrame: request.isForMainFrame,
+ );
},
- urlLoading: (
+ urlLoading: (android_webview.WebView webView, String url) {
+ weakThis.target?._handleNavigation(url, isForMainFrame: true);
+ },
+ doUpdateVisitedHistory: (
android_webview.WebView webView,
String url,
+ bool isReload,
) {
- if (weakThis.target != null) {
- weakThis.target!._handleNavigation(url, isForMainFrame: true);
+ final UrlChangeCallback? callback = weakThis.target?._onUrlChange;
+ if (callback != null) {
+ callback(AndroidUrlChange(url: url, isReload: isReload));
}
},
);
@@ -833,6 +851,7 @@
WebResourceErrorCallback? _onWebResourceError;
NavigationRequestCallback? _onNavigationRequest;
LoadRequestCallback? _onLoadRequest;
+ UrlChangeCallback? _onUrlChange;
void _handleNavigation(
String url, {
@@ -913,4 +932,9 @@
) async {
_onWebResourceError = onWebResourceError;
}
+
+ @override
+ Future<void> setOnUrlChange(UrlChangeCallback onUrlChange) async {
+ _onUrlChange = onUrlChange;
+ }
}
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 9978ed4..1d232b2 100644
--- a/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart
+++ b/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart
@@ -292,6 +292,13 @@
);
void urlLoading(int instanceId, int webViewInstanceId, String url);
+
+ void doUpdateVisitedHistory(
+ int instanceId,
+ int webViewInstanceId,
+ String url,
+ bool isReload,
+ );
}
@HostApi(dartHostTestHandler: 'TestDownloadListenerHostApi')
diff --git a/packages/webview_flutter/webview_flutter_android/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/pubspec.yaml
index 37b3826..7eb5411 100644
--- a/packages/webview_flutter/webview_flutter_android/pubspec.yaml
+++ b/packages/webview_flutter/webview_flutter_android/pubspec.yaml
@@ -2,7 +2,7 @@
description: A Flutter plugin that provides a WebView widget on Android.
repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22
-version: 3.4.5
+version: 3.5.0
environment:
sdk: ">=2.18.0 <4.0.0"
@@ -20,7 +20,7 @@
dependencies:
flutter:
sdk: flutter
- webview_flutter_platform_interface: ^2.0.0
+ webview_flutter_platform_interface: ^2.1.0
dev_dependencies:
build_runner: ^2.1.4
diff --git a/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.dart b/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.dart
index 2bf563b..1801589 100644
--- a/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.dart
+++ b/packages/webview_flutter/webview_flutter_android/test/android_navigation_delegate_test.dart
@@ -447,6 +447,27 @@
expect(completer.isCompleted, true);
});
});
+
+ test('onUrlChange', () {
+ final AndroidNavigationDelegate androidNavigationDelegate =
+ AndroidNavigationDelegate(_buildCreationParams());
+
+ late final AndroidUrlChange urlChange;
+ androidNavigationDelegate.setOnUrlChange(
+ (UrlChange change) {
+ urlChange = change as AndroidUrlChange;
+ },
+ );
+
+ CapturingWebViewClient.lastCreatedDelegate.doUpdateVisitedHistory!(
+ android_webview.WebView.detached(),
+ 'https://www.google.com',
+ false,
+ );
+
+ expect(urlChange.url, 'https://www.google.com');
+ expect(urlChange.isReload, isFalse);
+ });
}
AndroidNavigationDelegateCreationParams _buildCreationParams() {
@@ -471,6 +492,7 @@
super.onReceivedRequestError,
super.requestLoading,
super.urlLoading,
+ super.doUpdateVisitedHistory,
super.binaryMessenger,
super.instanceManager,
}) : super.detached() {
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 78e3144..f224ff1 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
@@ -105,6 +105,11 @@
)? requestLoading,
void Function(android_webview.WebView webView, String url)?
urlLoading,
+ void Function(
+ android_webview.WebView webView,
+ String url,
+ bool isReload,
+ )? doUpdateVisitedHistory,
}) =>
mockWebViewClient ?? MockWebViewClient(),
createFlutterAssetManager: () =>
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 595db88..e0c637e 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
@@ -760,6 +760,11 @@
void Function(
_i2.WebView,
String,
+ bool,
+ )? doUpdateVisitedHistory,
+ void Function(
+ _i2.WebView,
+ String,
)? onPageFinished,
void Function(
_i2.WebView,
@@ -790,6 +795,11 @@
void Function(
_i2.WebView,
String,
+ bool,
+ )? doUpdateVisitedHistory,
+ void Function(
+ _i2.WebView,
+ String,
)? onPageFinished,
void Function(
_i2.WebView,
@@ -823,6 +833,11 @@
void Function(
_i2.WebView,
String,
+ bool,
+ )? doUpdateVisitedHistory,
+ void Function(
+ _i2.WebView,
+ String,
)? onPageFinished,
void Function(
_i2.WebView,
@@ -856,6 +871,11 @@
void Function(
_i2.WebView,
String,
+ bool,
+ )? doUpdateVisitedHistory,
+ void Function(
+ _i2.WebView,
+ String,
)? onPageFinished,
void Function(
_i2.WebView,
diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_test.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_test.dart
index f447926..71c30b6 100644
--- a/packages/webview_flutter/webview_flutter_android/test/android_webview_test.dart
+++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_test.dart
@@ -739,6 +739,33 @@
);
});
+ test('doUpdateVisitedHistory', () {
+ late final List<Object> result;
+ when(mockWebViewClient.doUpdateVisitedHistory).thenReturn(
+ (
+ WebView webView,
+ String url,
+ bool isReload,
+ ) {
+ result = <Object>[webView, url, isReload];
+ },
+ );
+
+ flutterApi.doUpdateVisitedHistory(
+ mockWebViewClientInstanceId,
+ mockWebViewInstanceId,
+ 'https://www.google.com',
+ false,
+ );
+
+ expect(
+ result,
+ containsAllInOrder(
+ <Object?>[mockWebView, 'https://www.google.com', false],
+ ),
+ );
+ });
+
test('copy', () {
expect(WebViewClient.detached().copy(), isA<WebViewClient>());
});
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 33ab0ec..5857a09 100644
--- a/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart
+++ b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.g.dart
@@ -1,7 +1,7 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Autogenerated from Pigeon (v9.0.5), do not edit directly.
+// Autogenerated from Pigeon (v9.2.3), do not edit directly.
// See also: https://pub.dev/packages/pigeon
// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis, unnecessary_import
// ignore_for_file: avoid_relative_lib_imports
@@ -15,6 +15,8 @@
/// Host API for managing the native `InstanceManager`.
abstract class TestInstanceManagerHostApi {
+ static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding =>
+ TestDefaultBinaryMessengerBinding.instance;
static const MessageCodec<Object?> codec = StandardMessageCodec();
/// Clear the native `InstanceManager`.
@@ -29,9 +31,12 @@
'dev.flutter.pigeon.InstanceManagerHostApi.clear', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
// ignore message
api.clear();
return <Object?>[];
@@ -47,6 +52,8 @@
///
/// See https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html.
abstract class TestJavaObjectHostApi {
+ static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding =>
+ TestDefaultBinaryMessengerBinding.instance;
static const MessageCodec<Object?> codec = StandardMessageCodec();
void dispose(int identifier);
@@ -58,9 +65,12 @@
'dev.flutter.pigeon.JavaObjectHostApi.dispose', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.JavaObjectHostApi.dispose was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -99,6 +109,8 @@
}
abstract class TestWebViewHostApi {
+ static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding =>
+ TestDefaultBinaryMessengerBinding.instance;
static const MessageCodec<Object?> codec = _TestWebViewHostApiCodec();
void create(int instanceId);
@@ -162,9 +174,12 @@
'dev.flutter.pigeon.WebViewHostApi.create', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.create was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -181,9 +196,12 @@
'dev.flutter.pigeon.WebViewHostApi.loadData', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -205,9 +223,12 @@
'dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -232,9 +253,12 @@
'dev.flutter.pigeon.WebViewHostApi.loadUrl', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.loadUrl was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -258,9 +282,12 @@
'dev.flutter.pigeon.WebViewHostApi.postUrl', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.postUrl was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -283,9 +310,12 @@
'dev.flutter.pigeon.WebViewHostApi.getUrl', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.getUrl was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -302,9 +332,12 @@
'dev.flutter.pigeon.WebViewHostApi.canGoBack', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.canGoBack was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -321,9 +354,12 @@
'dev.flutter.pigeon.WebViewHostApi.canGoForward', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.canGoForward was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -340,9 +376,12 @@
'dev.flutter.pigeon.WebViewHostApi.goBack', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.goBack was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -359,9 +398,12 @@
'dev.flutter.pigeon.WebViewHostApi.goForward', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.goForward was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -378,9 +420,12 @@
'dev.flutter.pigeon.WebViewHostApi.reload', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.reload was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -397,9 +442,12 @@
'dev.flutter.pigeon.WebViewHostApi.clearCache', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.clearCache was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -419,9 +467,12 @@
'dev.flutter.pigeon.WebViewHostApi.evaluateJavascript', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -442,9 +493,12 @@
'dev.flutter.pigeon.WebViewHostApi.getTitle', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.getTitle was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -461,9 +515,12 @@
'dev.flutter.pigeon.WebViewHostApi.scrollTo', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.scrollTo was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -486,9 +543,12 @@
'dev.flutter.pigeon.WebViewHostApi.scrollBy', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.scrollBy was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -511,9 +571,12 @@
'dev.flutter.pigeon.WebViewHostApi.getScrollX', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollX was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -530,9 +593,12 @@
'dev.flutter.pigeon.WebViewHostApi.getScrollY', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollY was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -549,9 +615,12 @@
'dev.flutter.pigeon.WebViewHostApi.getScrollPosition', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.getScrollPosition was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -569,9 +638,12 @@
codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.setWebContentsDebuggingEnabled was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -588,9 +660,12 @@
'dev.flutter.pigeon.WebViewHostApi.setWebViewClient', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.setWebViewClient was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -610,9 +685,12 @@
'dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -633,9 +711,12 @@
'dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -656,9 +737,12 @@
'dev.flutter.pigeon.WebViewHostApi.setDownloadListener', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -676,9 +760,12 @@
'dev.flutter.pigeon.WebViewHostApi.setWebChromeClient', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -696,9 +783,12 @@
'dev.flutter.pigeon.WebViewHostApi.setBackgroundColor', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.setBackgroundColor was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -717,6 +807,8 @@
}
abstract class TestWebSettingsHostApi {
+ static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding =>
+ TestDefaultBinaryMessengerBinding.instance;
static const MessageCodec<Object?> codec = StandardMessageCodec();
void create(int instanceId, int webViewInstanceId);
@@ -754,9 +846,12 @@
'dev.flutter.pigeon.WebSettingsHostApi.create', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebSettingsHostApi.create was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -776,9 +871,12 @@
'dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -799,9 +897,12 @@
codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptCanOpenWindowsAutomatically was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -823,9 +924,12 @@
codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportMultipleWindows was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -845,9 +949,12 @@
'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -867,9 +974,12 @@
'dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -888,9 +998,12 @@
codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebSettingsHostApi.setMediaPlaybackRequiresUserGesture was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -911,9 +1024,12 @@
'dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -934,9 +1050,12 @@
codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -956,9 +1075,12 @@
'dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -978,9 +1100,12 @@
'dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -1000,9 +1125,12 @@
'dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -1022,9 +1150,12 @@
'dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -1044,9 +1175,12 @@
'dev.flutter.pigeon.WebSettingsHostApi.setTextZoom', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebSettingsHostApi.setTextZoom was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -1065,6 +1199,8 @@
}
abstract class TestJavaScriptChannelHostApi {
+ static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding =>
+ TestDefaultBinaryMessengerBinding.instance;
static const MessageCodec<Object?> codec = StandardMessageCodec();
void create(int instanceId, String channelName);
@@ -1076,9 +1212,12 @@
'dev.flutter.pigeon.JavaScriptChannelHostApi.create', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.JavaScriptChannelHostApi.create was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -1097,6 +1236,8 @@
}
abstract class TestWebViewClientHostApi {
+ static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding =>
+ TestDefaultBinaryMessengerBinding.instance;
static const MessageCodec<Object?> codec = StandardMessageCodec();
void create(int instanceId);
@@ -1111,9 +1252,12 @@
'dev.flutter.pigeon.WebViewClientHostApi.create', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewClientHostApi.create was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -1131,9 +1275,12 @@
codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebViewClientHostApi.setSynchronousReturnValueForShouldOverrideUrlLoading was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -1153,6 +1300,8 @@
}
abstract class TestDownloadListenerHostApi {
+ static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding =>
+ TestDefaultBinaryMessengerBinding.instance;
static const MessageCodec<Object?> codec = StandardMessageCodec();
void create(int instanceId);
@@ -1164,9 +1313,12 @@
'dev.flutter.pigeon.DownloadListenerHostApi.create', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.DownloadListenerHostApi.create was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -1182,6 +1334,8 @@
}
abstract class TestWebChromeClientHostApi {
+ static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding =>
+ TestDefaultBinaryMessengerBinding.instance;
static const MessageCodec<Object?> codec = StandardMessageCodec();
void create(int instanceId);
@@ -1196,9 +1350,12 @@
'dev.flutter.pigeon.WebChromeClientHostApi.create', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebChromeClientHostApi.create was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -1216,9 +1373,12 @@
codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebChromeClientHostApi.setSynchronousReturnValueForOnShowFileChooser was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -1238,6 +1398,8 @@
}
abstract class TestAssetManagerHostApi {
+ static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding =>
+ TestDefaultBinaryMessengerBinding.instance;
static const MessageCodec<Object?> codec = StandardMessageCodec();
List<String?> list(String path);
@@ -1251,9 +1413,12 @@
'dev.flutter.pigeon.FlutterAssetManagerHostApi.list', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.list was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -1271,9 +1436,12 @@
codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.FlutterAssetManagerHostApi.getAssetFilePathByName was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -1289,6 +1457,8 @@
}
abstract class TestWebStorageHostApi {
+ static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding =>
+ TestDefaultBinaryMessengerBinding.instance;
static const MessageCodec<Object?> codec = StandardMessageCodec();
void create(int instanceId);
@@ -1302,9 +1472,12 @@
'dev.flutter.pigeon.WebStorageHostApi.create', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebStorageHostApi.create was null.');
final List<Object?> args = (message as List<Object?>?)!;
@@ -1321,9 +1494,12 @@
'dev.flutter.pigeon.WebStorageHostApi.deleteAllData', codec,
binaryMessenger: binaryMessenger);
if (api == null) {
- channel.setMockMessageHandler(null);
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
} else {
- channel.setMockMessageHandler((Object? message) async {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
assert(message != null,
'Argument for dev.flutter.pigeon.WebStorageHostApi.deleteAllData was null.');
final List<Object?> args = (message as List<Object?>?)!;
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md b/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md
index bfce209..dc83b54 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md
+++ b/packages/webview_flutter/webview_flutter_wkwebview/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 3.3.0
+
+* Adds support for `PlatformNavigationDelegate.onUrlChange`.
+
## 3.2.4
* Updates pigeon to fix warnings with clang 15.
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/webview_flutter_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/webview_flutter_test.dart
index b51d7d8..42b5555 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/webview_flutter_test.dart
+++ b/packages/webview_flutter/webview_flutter_wkwebview/example/integration_test/webview_flutter_test.dart
@@ -1002,6 +1002,81 @@
final String? currentUrl = await controller.currentUrl();
expect(currentUrl, secondaryUrl);
});
+
+ testWidgets('can receive url changes', (WidgetTester tester) async {
+ final Completer<void> pageLoaded = Completer<void>();
+
+ final PlatformNavigationDelegate navigationDelegate =
+ PlatformNavigationDelegate(
+ const PlatformNavigationDelegateCreationParams(),
+ )..setOnPageFinished((_) => pageLoaded.complete());
+
+ final PlatformWebViewController controller = PlatformWebViewController(
+ const PlatformWebViewControllerCreationParams(),
+ )
+ ..setJavaScriptMode(JavaScriptMode.unrestricted)
+ ..setPlatformNavigationDelegate(navigationDelegate)
+ ..loadRequest(LoadRequestParams(uri: Uri.parse(blankPageEncoded)));
+
+ await tester.pumpWidget(Builder(
+ builder: (BuildContext context) {
+ return PlatformWebViewWidget(
+ PlatformWebViewWidgetCreationParams(controller: controller),
+ ).build(context);
+ },
+ ));
+
+ await pageLoaded.future;
+ await navigationDelegate.setOnPageFinished((_) {});
+
+ final Completer<String> urlChangeCompleter = Completer<String>();
+ await navigationDelegate.setOnUrlChange((UrlChange change) {
+ urlChangeCompleter.complete(change.url);
+ });
+
+ await controller.runJavaScript('location.href = "$primaryUrl"');
+
+ await expectLater(urlChangeCompleter.future, completion(primaryUrl));
+ });
+
+ testWidgets('can receive updates to history state',
+ (WidgetTester tester) async {
+ final Completer<void> pageLoaded = Completer<void>();
+
+ final PlatformNavigationDelegate navigationDelegate =
+ PlatformNavigationDelegate(
+ const PlatformNavigationDelegateCreationParams(),
+ )..setOnPageFinished((_) => pageLoaded.complete());
+
+ final PlatformWebViewController controller = PlatformWebViewController(
+ const PlatformWebViewControllerCreationParams(),
+ )
+ ..setJavaScriptMode(JavaScriptMode.unrestricted)
+ ..setPlatformNavigationDelegate(navigationDelegate)
+ ..loadRequest(LoadRequestParams(uri: Uri.parse(primaryUrl)));
+
+ await tester.pumpWidget(Builder(
+ builder: (BuildContext context) {
+ return PlatformWebViewWidget(
+ PlatformWebViewWidgetCreationParams(controller: controller),
+ ).build(context);
+ },
+ ));
+
+ await pageLoaded.future;
+ await navigationDelegate.setOnPageFinished((_) {});
+
+ final Completer<String> urlChangeCompleter = Completer<String>();
+ await navigationDelegate.setOnUrlChange((UrlChange change) {
+ urlChangeCompleter.complete(change.url);
+ });
+
+ await controller.runJavaScript(
+ 'window.history.pushState({}, "", "secondary.txt");',
+ );
+
+ await expectLater(urlChangeCompleter.future, completion(secondaryUrl));
+ });
});
testWidgets('launches with gestureNavigationEnabled on iOS',
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj
index 9e1038d..19e2b39 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj
+++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/Runner.xcodeproj/project.pbxproj
@@ -10,6 +10,7 @@
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
8F4FF949299ADC2D000A6586 /* FWFWebViewFlutterWKWebViewExternalAPITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F4FF948299ADC2D000A6586 /* FWFWebViewFlutterWKWebViewExternalAPITests.m */; };
+ 8F4FF94B29AC223F000A6586 /* FWFURLTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8F4FF94A29AC223F000A6586 /* FWFURLTests.m */; };
8FA6A87928062CD000A4B183 /* FWFInstanceManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FA6A87828062CD000A4B183 /* FWFInstanceManagerTests.m */; };
8FB79B5328134C3100C101D3 /* FWFWebViewHostApiTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B5228134C3100C101D3 /* FWFWebViewHostApiTests.m */; };
8FB79B55281B24F600C101D3 /* FWFDataConvertersTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 8FB79B54281B24F600C101D3 /* FWFDataConvertersTests.m */; };
@@ -78,6 +79,7 @@
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
8F4FF948299ADC2D000A6586 /* FWFWebViewFlutterWKWebViewExternalAPITests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FWFWebViewFlutterWKWebViewExternalAPITests.m; sourceTree = "<group>"; };
+ 8F4FF94A29AC223F000A6586 /* FWFURLTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFURLTests.m; sourceTree = "<group>"; };
8FA6A87828062CD000A4B183 /* FWFInstanceManagerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFInstanceManagerTests.m; sourceTree = "<group>"; };
8FB79B5228134C3100C101D3 /* FWFWebViewHostApiTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFWebViewHostApiTests.m; sourceTree = "<group>"; };
8FB79B54281B24F600C101D3 /* FWFDataConvertersTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FWFDataConvertersTests.m; sourceTree = "<group>"; };
@@ -162,6 +164,7 @@
8FB79B8E2820BAB300C101D3 /* FWFScrollViewHostApiTests.m */,
8FB79B902820BAC700C101D3 /* FWFUIViewHostApiTests.m */,
8FB79B962821985200C101D3 /* FWFObjectHostApiTests.m */,
+ 8F4FF94A29AC223F000A6586 /* FWFURLTests.m */,
);
path = RunnerTests;
sourceTree = "<group>";
@@ -463,6 +466,7 @@
buildActionMask = 2147483647;
files = (
8FA6A87928062CD000A4B183 /* FWFInstanceManagerTests.m in Sources */,
+ 8F4FF94B29AC223F000A6586 /* FWFURLTests.m in Sources */,
8FB79B852820A3A400C101D3 /* FWFUIDelegateHostApiTests.m in Sources */,
8FB79B972821985200C101D3 /* FWFObjectHostApiTests.m in Sources */,
8FB79B672820453400C101D3 /* FWFHTTPCookieStoreHostApiTests.m in Sources */,
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m
index b8e41d1..888a3a1 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m
+++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFObjectHostApiTests.m
@@ -139,7 +139,43 @@
return value[0].value == FWFNSKeyValueChangeKeyEnumOldValue;
}]
changeValues:[OCMArg checkWithBlock:^BOOL(id value) {
- return [@"key" isEqual:value[0]];
+ FWFObjectOrIdentifier *object = (FWFObjectOrIdentifier *)value[0];
+ return !object.isIdentifier.boolValue &&
+ [@"key" isEqual:object.value];
+ }]
+ completion:OCMOCK_ANY]);
+}
+
+- (void)testObserveValueForKeyPathWithIdentifier {
+ FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init];
+
+ FWFObject *mockObject = [self mockObjectWithManager:instanceManager identifier:0];
+ FWFObjectFlutterApiImpl *mockFlutterAPI = [self mockFlutterApiWithManager:instanceManager];
+
+ OCMStub([mockObject objectApi]).andReturn(mockFlutterAPI);
+
+ NSObject *object = [[NSObject alloc] init];
+ [instanceManager addDartCreatedInstance:object withIdentifier:1];
+
+ NSObject *returnedObject = [[NSObject alloc] init];
+ [instanceManager addDartCreatedInstance:returnedObject withIdentifier:2];
+
+ [mockObject observeValueForKeyPath:@"keyPath"
+ ofObject:object
+ change:@{NSKeyValueChangeOldKey : returnedObject}
+ context:nil];
+ OCMVerify([mockFlutterAPI
+ observeValueForObjectWithIdentifier:@0
+ keyPath:@"keyPath"
+ objectIdentifier:@1
+ changeKeys:[OCMArg checkWithBlock:^BOOL(
+ NSArray<FWFNSKeyValueChangeKeyEnumData *>
+ *value) {
+ return value[0].value == FWFNSKeyValueChangeKeyEnumOldValue;
+ }]
+ changeValues:[OCMArg checkWithBlock:^BOOL(id value) {
+ FWFObjectOrIdentifier *object = (FWFObjectOrIdentifier *)value[0];
+ return object.isIdentifier.boolValue && [@(2) isEqual:object.value];
}]
completion:OCMOCK_ANY]);
}
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLTests.m b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLTests.m
new file mode 100644
index 0000000..bf4dc36
--- /dev/null
+++ b/packages/webview_flutter/webview_flutter_wkwebview/example/ios/RunnerTests/FWFURLTests.m
@@ -0,0 +1,48 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+@import Flutter;
+@import XCTest;
+@import webview_flutter_wkwebview;
+
+#import <OCMock/OCMock.h>
+
+@interface FWFURLTests : XCTestCase
+@end
+
+@implementation FWFURLTests
+- (void)testAbsoluteString {
+ NSURL *mockUrl = OCMClassMock([NSURL class]);
+ OCMStub([mockUrl absoluteString]).andReturn(@"https://www.google.com");
+
+ FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init];
+ [instanceManager addDartCreatedInstance:mockUrl withIdentifier:0];
+
+ FWFURLHostApiImpl *hostApi = [[FWFURLHostApiImpl alloc]
+ initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger))
+ instanceManager:instanceManager];
+
+ FlutterError *error;
+ XCTAssertEqualObjects([hostApi absoluteStringForNSURLWithIdentifier:@(0) error:&error],
+ @"https://www.google.com");
+ XCTAssertNil(error);
+}
+
+- (void)testFlutterApiCreate {
+ FWFInstanceManager *instanceManager = [[FWFInstanceManager alloc] init];
+ FWFURLFlutterApiImpl *flutterApi = [[FWFURLFlutterApiImpl alloc]
+ initWithBinaryMessenger:OCMProtocolMock(@protocol(FlutterBinaryMessenger))
+ instanceManager:instanceManager];
+
+ flutterApi.api = OCMClassMock([FWFNSUrlFlutterApi class]);
+
+ NSURL *url = [[NSURL alloc] initWithString:@"https://www.google.com"];
+ [flutterApi create:url
+ completion:^(FlutterError *error){
+ }];
+
+ long identifier = [instanceManager identifierWithStrongReferenceForInstance:url];
+ OCMVerify([flutterApi.api createWithIdentifier:@(identifier) completion:OCMOCK_ANY]);
+}
+@end
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/lib/main.dart b/packages/webview_flutter/webview_flutter_wkwebview/example/lib/main.dart
index 6489475..a793c2c 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/example/lib/main.dart
+++ b/packages/webview_flutter/webview_flutter_wkwebview/example/lib/main.dart
@@ -124,6 +124,9 @@
}
debugPrint('allowing navigation to ${request.url}');
return NavigationDecision.navigate;
+ })
+ ..setOnUrlChange((UrlChange change) {
+ debugPrint('url change to ${change.url}');
}),
)
..addJavaScriptChannel(JavaScriptChannelParams(
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/example/pubspec.yaml b/packages/webview_flutter/webview_flutter_wkwebview/example/pubspec.yaml
index 4af215c..b1ee082 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/example/pubspec.yaml
+++ b/packages/webview_flutter/webview_flutter_wkwebview/example/pubspec.yaml
@@ -10,7 +10,7 @@
flutter:
sdk: flutter
path_provider: ^2.0.6
- webview_flutter_platform_interface: ^2.0.0
+ webview_flutter_platform_interface: ^2.1.0
webview_flutter_wkwebview:
# When depending on this package from a real application you should use:
# webview_flutter: ^x.y.z
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FLTWebViewFlutterPlugin.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FLTWebViewFlutterPlugin.m
index 6233a4e..2f91983 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FLTWebViewFlutterPlugin.m
+++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FLTWebViewFlutterPlugin.m
@@ -13,6 +13,7 @@
#import "FWFScrollViewHostApi.h"
#import "FWFUIDelegateHostApi.h"
#import "FWFUIViewHostApi.h"
+#import "FWFURLHostApi.h"
#import "FWFUserContentControllerHostApi.h"
#import "FWFWebViewConfigurationHostApi.h"
#import "FWFWebViewHostApi.h"
@@ -100,6 +101,9 @@
FWFWKWebViewHostApiSetup(registrar.messenger, [[FWFWebViewHostApiImpl alloc]
initWithBinaryMessenger:registrar.messenger
instanceManager:instanceManager]);
+ FWFNSUrlHostApiSetup(registrar.messenger,
+ [[FWFURLHostApiImpl alloc] initWithBinaryMessenger:registrar.messenger
+ instanceManager:instanceManager]);
FWFWebViewFactory *webviewFactory = [[FWFWebViewFactory alloc] initWithManager:instanceManager];
[registrar registerViewFactory:webviewFactory withId:@"plugins.flutter.io/webview"];
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h
index 0ebb402..1eb95ff 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h
+++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.h
@@ -159,6 +159,7 @@
@class FWFNSErrorData;
@class FWFWKScriptMessageData;
@class FWFNSHttpCookieData;
+@class FWFObjectOrIdentifier;
@interface FWFNSKeyValueObservingOptionsEnumData : NSObject
/// `init` unavailable to enforce nonnull fields, see the `make` class method.
@@ -300,6 +301,19 @@
@property(nonatomic, strong) NSArray<id> *propertyValues;
@end
+/// An object that can represent either a value supported by
+/// `StandardMessageCodec`, a data class in this pigeon file, or an identifier
+/// of an object stored in an `InstanceManager`.
+@interface FWFObjectOrIdentifier : NSObject
+/// `init` unavailable to enforce nonnull fields, see the `make` class method.
+- (instancetype)init NS_UNAVAILABLE;
++ (instancetype)makeWithValue:(id)value isIdentifier:(NSNumber *)isIdentifier;
+@property(nonatomic, strong) id value;
+/// Whether value is an int that is used to retrieve an instance stored in an
+/// `InstanceManager`.
+@property(nonatomic, strong) NSNumber *isIdentifier;
+@end
+
/// The codec used by FWFWKWebsiteDataStoreHostApi.
NSObject<FlutterMessageCodec> *FWFWKWebsiteDataStoreHostApiGetCodec(void);
@@ -583,7 +597,7 @@
keyPath:(NSString *)keyPath
objectIdentifier:(NSNumber *)objectIdentifier
changeKeys:(NSArray<FWFNSKeyValueChangeKeyEnumData *> *)changeKeys
- changeValues:(NSArray<id> *)changeValues
+ changeValues:(NSArray<FWFObjectOrIdentifier *> *)changeValues
completion:(void (^)(FlutterError *_Nullable))completion;
- (void)disposeObjectWithIdentifier:(NSNumber *)identifier
completion:(void (^)(FlutterError *_Nullable))completion;
@@ -702,4 +716,39 @@
extern void FWFWKHttpCookieStoreHostApiSetup(id<FlutterBinaryMessenger> binaryMessenger,
NSObject<FWFWKHttpCookieStoreHostApi> *_Nullable api);
+/// The codec used by FWFNSUrlHostApi.
+NSObject<FlutterMessageCodec> *FWFNSUrlHostApiGetCodec(void);
+
+/// Host API for `NSUrl`.
+///
+/// This class may handle instantiating and adding native object instances that
+/// are attached to a Dart instance or method calls on the associated native
+/// class or an instance of the class.
+///
+/// See https://developer.apple.com/documentation/foundation/nsurl?language=objc.
+@protocol FWFNSUrlHostApi
+- (nullable NSString *)absoluteStringForNSURLWithIdentifier:(NSNumber *)identifier
+ error:
+ (FlutterError *_Nullable *_Nonnull)error;
+@end
+
+extern void FWFNSUrlHostApiSetup(id<FlutterBinaryMessenger> binaryMessenger,
+ NSObject<FWFNSUrlHostApi> *_Nullable api);
+
+/// The codec used by FWFNSUrlFlutterApi.
+NSObject<FlutterMessageCodec> *FWFNSUrlFlutterApiGetCodec(void);
+
+/// Flutter API for `NSUrl`.
+///
+/// This class may handle instantiating and adding Dart instances that are
+/// attached to a native instance or receiving callback methods from an
+/// overridden native class.
+///
+/// See https://developer.apple.com/documentation/foundation/nsurl?language=objc.
+@interface FWFNSUrlFlutterApi : NSObject
+- (instancetype)initWithBinaryMessenger:(id<FlutterBinaryMessenger>)binaryMessenger;
+- (void)createWithIdentifier:(NSNumber *)identifier
+ completion:(void (^)(FlutterError *_Nullable))completion;
+@end
+
NS_ASSUME_NONNULL_END
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m
index 957a4de..610bc02 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m
+++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFGeneratedWebKitApis.m
@@ -108,6 +108,12 @@
- (NSArray *)toList;
@end
+@interface FWFObjectOrIdentifier ()
++ (FWFObjectOrIdentifier *)fromList:(NSArray *)list;
++ (nullable FWFObjectOrIdentifier *)nullableFromList:(NSArray *)list;
+- (NSArray *)toList;
+@end
+
@implementation FWFNSKeyValueObservingOptionsEnumData
+ (instancetype)makeWithValue:(FWFNSKeyValueObservingOptionsEnum)value {
FWFNSKeyValueObservingOptionsEnumData *pigeonResult =
@@ -470,6 +476,31 @@
}
@end
+@implementation FWFObjectOrIdentifier
++ (instancetype)makeWithValue:(id)value isIdentifier:(NSNumber *)isIdentifier {
+ FWFObjectOrIdentifier *pigeonResult = [[FWFObjectOrIdentifier alloc] init];
+ pigeonResult.value = value;
+ pigeonResult.isIdentifier = isIdentifier;
+ return pigeonResult;
+}
++ (FWFObjectOrIdentifier *)fromList:(NSArray *)list {
+ FWFObjectOrIdentifier *pigeonResult = [[FWFObjectOrIdentifier alloc] init];
+ pigeonResult.value = GetNullableObjectAtIndex(list, 0);
+ pigeonResult.isIdentifier = GetNullableObjectAtIndex(list, 1);
+ NSAssert(pigeonResult.isIdentifier != nil, @"");
+ return pigeonResult;
+}
++ (nullable FWFObjectOrIdentifier *)nullableFromList:(NSArray *)list {
+ return (list) ? [FWFObjectOrIdentifier fromList:list] : nil;
+}
+- (NSArray *)toList {
+ return @[
+ (self.value ?: [NSNull null]),
+ (self.isIdentifier ?: [NSNull null]),
+ ];
+}
+@end
+
@interface FWFWKWebsiteDataStoreHostApiCodecReader : FlutterStandardReader
@end
@implementation FWFWKWebsiteDataStoreHostApiCodecReader
@@ -1680,33 +1711,9 @@
- (nullable id)readValueOfType:(UInt8)type {
switch (type) {
case 128:
- return [FWFNSErrorData fromList:[self readValue]];
- case 129:
- return [FWFNSHttpCookieData fromList:[self readValue]];
- case 130:
- return [FWFNSHttpCookiePropertyKeyEnumData fromList:[self readValue]];
- case 131:
return [FWFNSKeyValueChangeKeyEnumData fromList:[self readValue]];
- case 132:
- return [FWFNSKeyValueObservingOptionsEnumData fromList:[self readValue]];
- case 133:
- return [FWFNSUrlRequestData fromList:[self readValue]];
- case 134:
- return [FWFWKAudiovisualMediaTypeEnumData fromList:[self readValue]];
- case 135:
- return [FWFWKFrameInfoData fromList:[self readValue]];
- case 136:
- return [FWFWKNavigationActionData fromList:[self readValue]];
- case 137:
- return [FWFWKNavigationActionPolicyEnumData fromList:[self readValue]];
- case 138:
- return [FWFWKScriptMessageData fromList:[self readValue]];
- case 139:
- return [FWFWKUserScriptData fromList:[self readValue]];
- case 140:
- return [FWFWKUserScriptInjectionTimeEnumData fromList:[self readValue]];
- case 141:
- return [FWFWKWebsiteDataTypeEnumData fromList:[self readValue]];
+ case 129:
+ return [FWFObjectOrIdentifier fromList:[self readValue]];
default:
return [super readValueOfType:type];
}
@@ -1717,48 +1724,12 @@
@end
@implementation FWFNSObjectFlutterApiCodecWriter
- (void)writeValue:(id)value {
- if ([value isKindOfClass:[FWFNSErrorData class]]) {
+ if ([value isKindOfClass:[FWFNSKeyValueChangeKeyEnumData class]]) {
[self writeByte:128];
[self writeValue:[value toList]];
- } else if ([value isKindOfClass:[FWFNSHttpCookieData class]]) {
+ } else if ([value isKindOfClass:[FWFObjectOrIdentifier class]]) {
[self writeByte:129];
[self writeValue:[value toList]];
- } else if ([value isKindOfClass:[FWFNSHttpCookiePropertyKeyEnumData class]]) {
- [self writeByte:130];
- [self writeValue:[value toList]];
- } else if ([value isKindOfClass:[FWFNSKeyValueChangeKeyEnumData class]]) {
- [self writeByte:131];
- [self writeValue:[value toList]];
- } else if ([value isKindOfClass:[FWFNSKeyValueObservingOptionsEnumData class]]) {
- [self writeByte:132];
- [self writeValue:[value toList]];
- } else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) {
- [self writeByte:133];
- [self writeValue:[value toList]];
- } else if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) {
- [self writeByte:134];
- [self writeValue:[value toList]];
- } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) {
- [self writeByte:135];
- [self writeValue:[value toList]];
- } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) {
- [self writeByte:136];
- [self writeValue:[value toList]];
- } else if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) {
- [self writeByte:137];
- [self writeValue:[value toList]];
- } else if ([value isKindOfClass:[FWFWKScriptMessageData class]]) {
- [self writeByte:138];
- [self writeValue:[value toList]];
- } else if ([value isKindOfClass:[FWFWKUserScriptData class]]) {
- [self writeByte:139];
- [self writeValue:[value toList]];
- } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) {
- [self writeByte:140];
- [self writeValue:[value toList]];
- } else if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) {
- [self writeByte:141];
- [self writeValue:[value toList]];
} else {
[super writeValue:value];
}
@@ -1805,7 +1776,7 @@
objectIdentifier:(NSNumber *)arg_objectIdentifier
changeKeys:
(NSArray<FWFNSKeyValueChangeKeyEnumData *> *)arg_changeKeys
- changeValues:(NSArray<id> *)arg_changeValues
+ changeValues:(NSArray<FWFObjectOrIdentifier *> *)arg_changeValues
completion:(void (^)(FlutterError *_Nullable))completion {
FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel
messageChannelWithName:@"dev.flutter.pigeon.NSObjectFlutterApi.observeValue"
@@ -1851,20 +1822,22 @@
case 133:
return [FWFNSUrlRequestData fromList:[self readValue]];
case 134:
- return [FWFWKAudiovisualMediaTypeEnumData fromList:[self readValue]];
+ return [FWFObjectOrIdentifier fromList:[self readValue]];
case 135:
- return [FWFWKFrameInfoData fromList:[self readValue]];
+ return [FWFWKAudiovisualMediaTypeEnumData fromList:[self readValue]];
case 136:
- return [FWFWKNavigationActionData fromList:[self readValue]];
+ return [FWFWKFrameInfoData fromList:[self readValue]];
case 137:
- return [FWFWKNavigationActionPolicyEnumData fromList:[self readValue]];
+ return [FWFWKNavigationActionData fromList:[self readValue]];
case 138:
- return [FWFWKScriptMessageData fromList:[self readValue]];
+ return [FWFWKNavigationActionPolicyEnumData fromList:[self readValue]];
case 139:
- return [FWFWKUserScriptData fromList:[self readValue]];
+ return [FWFWKScriptMessageData fromList:[self readValue]];
case 140:
- return [FWFWKUserScriptInjectionTimeEnumData fromList:[self readValue]];
+ return [FWFWKUserScriptData fromList:[self readValue]];
case 141:
+ return [FWFWKUserScriptInjectionTimeEnumData fromList:[self readValue]];
+ case 142:
return [FWFWKWebsiteDataTypeEnumData fromList:[self readValue]];
default:
return [super readValueOfType:type];
@@ -1894,30 +1867,33 @@
} else if ([value isKindOfClass:[FWFNSUrlRequestData class]]) {
[self writeByte:133];
[self writeValue:[value toList]];
- } else if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) {
+ } else if ([value isKindOfClass:[FWFObjectOrIdentifier class]]) {
[self writeByte:134];
[self writeValue:[value toList]];
- } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) {
+ } else if ([value isKindOfClass:[FWFWKAudiovisualMediaTypeEnumData class]]) {
[self writeByte:135];
[self writeValue:[value toList]];
- } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) {
+ } else if ([value isKindOfClass:[FWFWKFrameInfoData class]]) {
[self writeByte:136];
[self writeValue:[value toList]];
- } else if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) {
+ } else if ([value isKindOfClass:[FWFWKNavigationActionData class]]) {
[self writeByte:137];
[self writeValue:[value toList]];
- } else if ([value isKindOfClass:[FWFWKScriptMessageData class]]) {
+ } else if ([value isKindOfClass:[FWFWKNavigationActionPolicyEnumData class]]) {
[self writeByte:138];
[self writeValue:[value toList]];
- } else if ([value isKindOfClass:[FWFWKUserScriptData class]]) {
+ } else if ([value isKindOfClass:[FWFWKScriptMessageData class]]) {
[self writeByte:139];
[self writeValue:[value toList]];
- } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) {
+ } else if ([value isKindOfClass:[FWFWKUserScriptData class]]) {
[self writeByte:140];
[self writeValue:[value toList]];
- } else if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) {
+ } else if ([value isKindOfClass:[FWFWKUserScriptInjectionTimeEnumData class]]) {
[self writeByte:141];
[self writeValue:[value toList]];
+ } else if ([value isKindOfClass:[FWFWKWebsiteDataTypeEnumData class]]) {
+ [self writeByte:142];
+ [self writeValue:[value toList]];
} else {
[super writeValue:value];
}
@@ -2599,3 +2575,64 @@
}
}
}
+NSObject<FlutterMessageCodec> *FWFNSUrlHostApiGetCodec(void) {
+ static FlutterStandardMessageCodec *sSharedObject = nil;
+ sSharedObject = [FlutterStandardMessageCodec sharedInstance];
+ return sSharedObject;
+}
+
+void FWFNSUrlHostApiSetup(id<FlutterBinaryMessenger> binaryMessenger,
+ NSObject<FWFNSUrlHostApi> *api) {
+ {
+ FlutterBasicMessageChannel *channel = [[FlutterBasicMessageChannel alloc]
+ initWithName:@"dev.flutter.pigeon.NSUrlHostApi.getAbsoluteString"
+ binaryMessenger:binaryMessenger
+ codec:FWFNSUrlHostApiGetCodec()];
+ if (api) {
+ NSCAssert([api respondsToSelector:@selector(absoluteStringForNSURLWithIdentifier:error:)],
+ @"FWFNSUrlHostApi api (%@) doesn't respond to "
+ @"@selector(absoluteStringForNSURLWithIdentifier:error:)",
+ api);
+ [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) {
+ NSArray *args = message;
+ NSNumber *arg_identifier = GetNullableObjectAtIndex(args, 0);
+ FlutterError *error;
+ NSString *output = [api absoluteStringForNSURLWithIdentifier:arg_identifier error:&error];
+ callback(wrapResult(output, error));
+ }];
+ } else {
+ [channel setMessageHandler:nil];
+ }
+ }
+}
+NSObject<FlutterMessageCodec> *FWFNSUrlFlutterApiGetCodec(void) {
+ static FlutterStandardMessageCodec *sSharedObject = nil;
+ sSharedObject = [FlutterStandardMessageCodec sharedInstance];
+ return sSharedObject;
+}
+
+@interface FWFNSUrlFlutterApi ()
+@property(nonatomic, strong) NSObject<FlutterBinaryMessenger> *binaryMessenger;
+@end
+
+@implementation FWFNSUrlFlutterApi
+
+- (instancetype)initWithBinaryMessenger:(NSObject<FlutterBinaryMessenger> *)binaryMessenger {
+ self = [super init];
+ if (self) {
+ _binaryMessenger = binaryMessenger;
+ }
+ return self;
+}
+- (void)createWithIdentifier:(NSNumber *)arg_identifier
+ completion:(void (^)(FlutterError *_Nullable))completion {
+ FlutterBasicMessageChannel *channel = [FlutterBasicMessageChannel
+ messageChannelWithName:@"dev.flutter.pigeon.NSUrlFlutterApi.create"
+ binaryMessenger:self.binaryMessenger
+ codec:FWFNSUrlFlutterApiGetCodec()];
+ [channel sendMessage:@[ arg_identifier ?: [NSNull null] ]
+ reply:^(id reply) {
+ completion(nil);
+ }];
+}
+@end
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m
index 7da383c..4b014a7 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m
+++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFObjectHostApi.m
@@ -3,9 +3,14 @@
// found in the LICENSE file.
#import "FWFObjectHostApi.h"
+#import <objc/runtime.h>
#import "FWFDataConverters.h"
+#import "FWFURLHostApi.h"
@interface FWFObjectFlutterApiImpl ()
+// BinaryMessenger must be weak to prevent a circular reference with the host API it
+// references.
+@property(nonatomic, weak) id<FlutterBinaryMessenger> binaryMessenger;
// InstanceManager must be weak to prevent a circular reference with the object it stores.
@property(nonatomic, weak) FWFInstanceManager *instanceManager;
@end
@@ -15,6 +20,7 @@
instanceManager:(FWFInstanceManager *)instanceManager {
self = [self initWithBinaryMessenger:binaryMessenger];
if (self) {
+ _binaryMessenger = binaryMessenger;
_instanceManager = instanceManager;
}
return self;
@@ -34,7 +40,25 @@
[change enumerateKeysAndObjectsUsingBlock:^(NSKeyValueChangeKey key, id value, BOOL *stop) {
[changeKeys addObject:FWFNSKeyValueChangeKeyEnumDataFromNSKeyValueChangeKey(key)];
- [changeValues addObject:value];
+ BOOL isIdentifier = NO;
+ if ([self.instanceManager containsInstance:value]) {
+ isIdentifier = YES;
+ } else if (object_getClass(value) == [NSURL class]) {
+ FWFURLFlutterApiImpl *flutterApi =
+ [[FWFURLFlutterApiImpl alloc] initWithBinaryMessenger:self.binaryMessenger
+ instanceManager:self.instanceManager];
+ [flutterApi create:value
+ completion:^(FlutterError *error) {
+ NSAssert(!error, @"%@", error);
+ }];
+ isIdentifier = YES;
+ }
+
+ id returnValue = isIdentifier
+ ? @([self.instanceManager identifierWithStrongReferenceForInstance:value])
+ : value;
+ [changeValues addObject:[FWFObjectOrIdentifier makeWithValue:returnValue
+ isIdentifier:@(isIdentifier)]];
}];
NSNumber *objectIdentifier =
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLHostApi.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLHostApi.h
new file mode 100644
index 0000000..248f0b7
--- /dev/null
+++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLHostApi.h
@@ -0,0 +1,42 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import <Flutter/Flutter.h>
+#import <Foundation/Foundation.h>
+#import "FWFGeneratedWebKitApis.h"
+#import "FWFInstanceManager.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ * Host API implementation for `NSURL`.
+ *
+ * This class may handle instantiating and adding native object instances that are attached to a
+ * Dart instance or method calls on the associated native class or an instance of the class.
+ */
+@interface FWFURLHostApiImpl : NSObject <FWFNSUrlHostApi>
+- (instancetype)initWithBinaryMessenger:(id<FlutterBinaryMessenger>)binaryMessenger
+ instanceManager:(FWFInstanceManager *)instanceManager;
+@end
+
+/**
+ * Flutter API implementation for `NSURL`.
+ *
+ * This class may handle instantiating and adding Dart instances that are attached to a native
+ * instance or sending callback methods from an overridden native class.
+ */
+@interface FWFURLFlutterApiImpl : NSObject
+/**
+ * The Flutter API used to send messages back to Dart.
+ */
+@property FWFNSUrlFlutterApi *api;
+- (instancetype)initWithBinaryMessenger:(id<FlutterBinaryMessenger>)binaryMessenger
+ instanceManager:(FWFInstanceManager *)instanceManager;
+/**
+ * Sends a message to Dart to create a new Dart instance and add it to the `InstanceManager`.
+ */
+- (void)create:(NSURL *)instance completion:(void (^)(FlutterError *_Nullable))completion;
+@end
+
+NS_ASSUME_NONNULL_END
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLHostApi.m b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLHostApi.m
new file mode 100644
index 0000000..9f747c2
--- /dev/null
+++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/FWFURLHostApi.m
@@ -0,0 +1,74 @@
+// Copyright 2013 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "FWFURLHostApi.h"
+
+@interface FWFURLHostApiImpl ()
+// BinaryMessenger must be weak to prevent a circular reference with the host API it
+// references.
+@property(nonatomic, weak) id<FlutterBinaryMessenger> binaryMessenger;
+// InstanceManager must be weak to prevent a circular reference with the object it stores.
+@property(nonatomic, weak) FWFInstanceManager *instanceManager;
+@end
+
+@interface FWFURLFlutterApiImpl ()
+// InstanceManager must be weak to prevent a circular reference with the object it stores.
+@property(nonatomic, weak) FWFInstanceManager *instanceManager;
+@end
+
+@implementation FWFURLHostApiImpl
+- (instancetype)initWithBinaryMessenger:(id<FlutterBinaryMessenger>)binaryMessenger
+ instanceManager:(FWFInstanceManager *)instanceManager {
+ self = [self init];
+ if (self) {
+ _binaryMessenger = binaryMessenger;
+ _instanceManager = instanceManager;
+ }
+ return self;
+}
+
+- (nullable NSString *)
+ absoluteStringForNSURLWithIdentifier:(nonnull NSNumber *)identifier
+ error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error {
+ NSURL *instance = [self urlForIdentifier:identifier error:error];
+ if (*error) {
+ return nil;
+ }
+
+ return instance.absoluteString;
+}
+
+- (nullable NSURL *)urlForIdentifier:(NSNumber *)identifier
+ error:(FlutterError *_Nullable __autoreleasing *_Nonnull)error {
+ NSURL *instance = (NSURL *)[self.instanceManager instanceForIdentifier:identifier.longValue];
+
+ if (!instance) {
+ NSString *message =
+ [NSString stringWithFormat:@"InstanceManager does not contain an NSURL with identifier: %@",
+ identifier];
+ *error = [FlutterError errorWithCode:NSInternalInconsistencyException
+ message:message
+ details:nil];
+ }
+
+ return instance;
+}
+@end
+
+@implementation FWFURLFlutterApiImpl
+- (instancetype)initWithBinaryMessenger:(id<FlutterBinaryMessenger>)binaryMessenger
+ instanceManager:(FWFInstanceManager *)instanceManager {
+ self = [self init];
+ if (self) {
+ _instanceManager = instanceManager;
+ _api = [[FWFNSUrlFlutterApi alloc] initWithBinaryMessenger:binaryMessenger];
+ }
+ return self;
+}
+
+- (void)create:(NSURL *)instance completion:(void (^)(FlutterError *_Nullable))completion {
+ [self.api createWithIdentifier:@([self.instanceManager addHostCreatedInstance:instance])
+ completion:completion];
+}
+@end
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h
index 9cf4ed2..2836829 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h
+++ b/packages/webview_flutter/webview_flutter_wkwebview/ios/Classes/webview-umbrella.h
@@ -16,6 +16,7 @@
#import "FWFScrollViewHostApi.h"
#import "FWFUIDelegateHostApi.h"
#import "FWFUIViewHostApi.h"
+#import "FWFURLHostApi.h"
#import "FWFUserContentControllerHostApi.h"
#import "FWFWebViewConfigurationHostApi.h"
#import "FWFWebViewFlutterWKWebViewExternalAPI.h"
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.g.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.g.dart
index 75d7aab..c44e52a 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.g.dart
+++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/common/web_kit.g.dart
@@ -513,6 +513,37 @@
}
}
+/// An object that can represent either a value supported by
+/// `StandardMessageCodec`, a data class in this pigeon file, or an identifier
+/// of an object stored in an `InstanceManager`.
+class ObjectOrIdentifier {
+ ObjectOrIdentifier({
+ this.value,
+ required this.isIdentifier,
+ });
+
+ Object? value;
+
+ /// Whether value is an int that is used to retrieve an instance stored in an
+ /// `InstanceManager`.
+ bool isIdentifier;
+
+ Object encode() {
+ return <Object?>[
+ value,
+ isIdentifier,
+ ];
+ }
+
+ static ObjectOrIdentifier decode(Object result) {
+ result as List<Object?>;
+ return ObjectOrIdentifier(
+ value: result[0] as Object?,
+ isIdentifier: result[1]! as bool,
+ );
+ }
+}
+
class _WKWebsiteDataStoreHostApiCodec extends StandardMessageCodec {
const _WKWebsiteDataStoreHostApiCodec();
@override
@@ -1699,48 +1730,12 @@
const _NSObjectFlutterApiCodec();
@override
void writeValue(WriteBuffer buffer, Object? value) {
- if (value is NSErrorData) {
+ if (value is NSKeyValueChangeKeyEnumData) {
buffer.putUint8(128);
writeValue(buffer, value.encode());
- } else if (value is NSHttpCookieData) {
+ } else if (value is ObjectOrIdentifier) {
buffer.putUint8(129);
writeValue(buffer, value.encode());
- } else if (value is NSHttpCookiePropertyKeyEnumData) {
- buffer.putUint8(130);
- writeValue(buffer, value.encode());
- } else if (value is NSKeyValueChangeKeyEnumData) {
- buffer.putUint8(131);
- writeValue(buffer, value.encode());
- } else if (value is NSKeyValueObservingOptionsEnumData) {
- buffer.putUint8(132);
- writeValue(buffer, value.encode());
- } else if (value is NSUrlRequestData) {
- buffer.putUint8(133);
- writeValue(buffer, value.encode());
- } else if (value is WKAudiovisualMediaTypeEnumData) {
- buffer.putUint8(134);
- writeValue(buffer, value.encode());
- } else if (value is WKFrameInfoData) {
- buffer.putUint8(135);
- writeValue(buffer, value.encode());
- } else if (value is WKNavigationActionData) {
- buffer.putUint8(136);
- writeValue(buffer, value.encode());
- } else if (value is WKNavigationActionPolicyEnumData) {
- buffer.putUint8(137);
- writeValue(buffer, value.encode());
- } else if (value is WKScriptMessageData) {
- buffer.putUint8(138);
- writeValue(buffer, value.encode());
- } else if (value is WKUserScriptData) {
- buffer.putUint8(139);
- writeValue(buffer, value.encode());
- } else if (value is WKUserScriptInjectionTimeEnumData) {
- buffer.putUint8(140);
- writeValue(buffer, value.encode());
- } else if (value is WKWebsiteDataTypeEnumData) {
- buffer.putUint8(141);
- writeValue(buffer, value.encode());
} else {
super.writeValue(buffer, value);
}
@@ -1750,33 +1745,9 @@
Object? readValueOfType(int type, ReadBuffer buffer) {
switch (type) {
case 128:
- return NSErrorData.decode(readValue(buffer)!);
- case 129:
- return NSHttpCookieData.decode(readValue(buffer)!);
- case 130:
- return NSHttpCookiePropertyKeyEnumData.decode(readValue(buffer)!);
- case 131:
return NSKeyValueChangeKeyEnumData.decode(readValue(buffer)!);
- case 132:
- return NSKeyValueObservingOptionsEnumData.decode(readValue(buffer)!);
- case 133:
- return NSUrlRequestData.decode(readValue(buffer)!);
- case 134:
- return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!);
- case 135:
- return WKFrameInfoData.decode(readValue(buffer)!);
- case 136:
- return WKNavigationActionData.decode(readValue(buffer)!);
- case 137:
- return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!);
- case 138:
- return WKScriptMessageData.decode(readValue(buffer)!);
- case 139:
- return WKUserScriptData.decode(readValue(buffer)!);
- case 140:
- return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!);
- case 141:
- return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!);
+ case 129:
+ return ObjectOrIdentifier.decode(readValue(buffer)!);
default:
return super.readValueOfType(type, buffer);
}
@@ -1794,7 +1765,7 @@
String keyPath,
int objectIdentifier,
List<NSKeyValueChangeKeyEnumData?> changeKeys,
- List<Object?> changeValues);
+ List<ObjectOrIdentifier?> changeValues);
void dispose(int identifier);
@@ -1824,10 +1795,10 @@
(args[3] as List<Object?>?)?.cast<NSKeyValueChangeKeyEnumData?>();
assert(arg_changeKeys != null,
'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null List<NSKeyValueChangeKeyEnumData?>.');
- final List<Object?>? arg_changeValues =
- (args[4] as List<Object?>?)?.cast<Object?>();
+ final List<ObjectOrIdentifier?>? arg_changeValues =
+ (args[4] as List<Object?>?)?.cast<ObjectOrIdentifier?>();
assert(arg_changeValues != null,
- 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null List<Object?>.');
+ 'Argument for dev.flutter.pigeon.NSObjectFlutterApi.observeValue was null, expected non-null List<ObjectOrIdentifier?>.');
api.observeValue(arg_identifier!, arg_keyPath!, arg_objectIdentifier!,
arg_changeKeys!, arg_changeValues!);
return;
@@ -1878,30 +1849,33 @@
} else if (value is NSUrlRequestData) {
buffer.putUint8(133);
writeValue(buffer, value.encode());
- } else if (value is WKAudiovisualMediaTypeEnumData) {
+ } else if (value is ObjectOrIdentifier) {
buffer.putUint8(134);
writeValue(buffer, value.encode());
- } else if (value is WKFrameInfoData) {
+ } else if (value is WKAudiovisualMediaTypeEnumData) {
buffer.putUint8(135);
writeValue(buffer, value.encode());
- } else if (value is WKNavigationActionData) {
+ } else if (value is WKFrameInfoData) {
buffer.putUint8(136);
writeValue(buffer, value.encode());
- } else if (value is WKNavigationActionPolicyEnumData) {
+ } else if (value is WKNavigationActionData) {
buffer.putUint8(137);
writeValue(buffer, value.encode());
- } else if (value is WKScriptMessageData) {
+ } else if (value is WKNavigationActionPolicyEnumData) {
buffer.putUint8(138);
writeValue(buffer, value.encode());
- } else if (value is WKUserScriptData) {
+ } else if (value is WKScriptMessageData) {
buffer.putUint8(139);
writeValue(buffer, value.encode());
- } else if (value is WKUserScriptInjectionTimeEnumData) {
+ } else if (value is WKUserScriptData) {
buffer.putUint8(140);
writeValue(buffer, value.encode());
- } else if (value is WKWebsiteDataTypeEnumData) {
+ } else if (value is WKUserScriptInjectionTimeEnumData) {
buffer.putUint8(141);
writeValue(buffer, value.encode());
+ } else if (value is WKWebsiteDataTypeEnumData) {
+ buffer.putUint8(142);
+ writeValue(buffer, value.encode());
} else {
super.writeValue(buffer, value);
}
@@ -1923,20 +1897,22 @@
case 133:
return NSUrlRequestData.decode(readValue(buffer)!);
case 134:
- return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!);
+ return ObjectOrIdentifier.decode(readValue(buffer)!);
case 135:
- return WKFrameInfoData.decode(readValue(buffer)!);
+ return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!);
case 136:
- return WKNavigationActionData.decode(readValue(buffer)!);
+ return WKFrameInfoData.decode(readValue(buffer)!);
case 137:
- return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!);
+ return WKNavigationActionData.decode(readValue(buffer)!);
case 138:
- return WKScriptMessageData.decode(readValue(buffer)!);
+ return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!);
case 139:
- return WKUserScriptData.decode(readValue(buffer)!);
+ return WKScriptMessageData.decode(readValue(buffer)!);
case 140:
- return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!);
+ return WKUserScriptData.decode(readValue(buffer)!);
case 141:
+ return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!);
+ case 142:
return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!);
default:
return super.readValueOfType(type, buffer);
@@ -2587,3 +2563,78 @@
}
}
}
+
+/// Host API for `NSUrl`.
+///
+/// This class may handle instantiating and adding native object instances that
+/// are attached to a Dart instance or method calls on the associated native
+/// class or an instance of the class.
+///
+/// See https://developer.apple.com/documentation/foundation/nsurl?language=objc.
+class NSUrlHostApi {
+ /// Constructor for [NSUrlHostApi]. The [binaryMessenger] named argument is
+ /// available for dependency injection. If it is left null, the default
+ /// BinaryMessenger will be used which routes to the host platform.
+ NSUrlHostApi({BinaryMessenger? binaryMessenger})
+ : _binaryMessenger = binaryMessenger;
+ final BinaryMessenger? _binaryMessenger;
+
+ static const MessageCodec<Object?> codec = StandardMessageCodec();
+
+ Future<String?> getAbsoluteString(int arg_identifier) async {
+ final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.NSUrlHostApi.getAbsoluteString', codec,
+ binaryMessenger: _binaryMessenger);
+ final List<Object?>? replyList =
+ await channel.send(<Object?>[arg_identifier]) as List<Object?>?;
+ if (replyList == null) {
+ throw PlatformException(
+ code: 'channel-error',
+ message: 'Unable to establish connection on channel.',
+ );
+ } else if (replyList.length > 1) {
+ throw PlatformException(
+ code: replyList[0]! as String,
+ message: replyList[1] as String?,
+ details: replyList[2],
+ );
+ } else {
+ return (replyList[0] as String?);
+ }
+ }
+}
+
+/// Flutter API for `NSUrl`.
+///
+/// This class may handle instantiating and adding Dart instances that are
+/// attached to a native instance or receiving callback methods from an
+/// overridden native class.
+///
+/// See https://developer.apple.com/documentation/foundation/nsurl?language=objc.
+abstract class NSUrlFlutterApi {
+ static const MessageCodec<Object?> codec = StandardMessageCodec();
+
+ void create(int identifier);
+
+ static void setup(NSUrlFlutterApi? api, {BinaryMessenger? binaryMessenger}) {
+ {
+ final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.NSUrlFlutterApi.create', codec,
+ binaryMessenger: binaryMessenger);
+ if (api == null) {
+ channel.setMessageHandler(null);
+ } else {
+ channel.setMessageHandler((Object? message) async {
+ assert(message != null,
+ 'Argument for dev.flutter.pigeon.NSUrlFlutterApi.create was null.');
+ final List<Object?> args = (message as List<Object?>?)!;
+ final int? arg_identifier = (args[0] as int?);
+ assert(arg_identifier != null,
+ 'Argument for dev.flutter.pigeon.NSUrlFlutterApi.create was null, expected non-null int.');
+ api.create(arg_identifier!);
+ return;
+ });
+ }
+ }
+ }
+}
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart
index 4d85c39..a9bbdc5 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart
+++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation.dart
@@ -235,6 +235,42 @@
final Map<NSHttpCookiePropertyKey, Object> properties;
}
+/// An object that represents the location of a resource, such as an item on a
+/// remote server or the path to a local file.
+///
+/// See https://developer.apple.com/documentation/foundation/nsurl?language=objc.
+class NSUrl extends NSObject {
+ /// Instantiates a [NSUrl] without creating and attaching to an instance
+ /// of the associated native class.
+ ///
+ /// This should only be used outside of tests by subclasses created by this
+ /// library or to create a copy for an [InstanceManager].
+ @protected
+ NSUrl.detached({super.binaryMessenger, super.instanceManager})
+ : _nsUrlHostApi = NSUrlHostApiImpl(
+ binaryMessenger: binaryMessenger,
+ instanceManager: instanceManager,
+ ),
+ super.detached();
+
+ final NSUrlHostApiImpl _nsUrlHostApi;
+
+ /// The URL string for the receiver as an absolute URL. (read-only)
+ ///
+ /// Represents [NSURL.absoluteString](https://developer.apple.com/documentation/foundation/nsurl/1409868-absolutestring?language=objc).
+ Future<String?> getAbsoluteString() {
+ return _nsUrlHostApi.getAbsoluteStringFromInstances(this);
+ }
+
+ @override
+ NSObject copy() {
+ return NSUrl.detached(
+ binaryMessenger: _nsUrlHostApi.binaryMessenger,
+ instanceManager: _nsUrlHostApi.instanceManager,
+ );
+ }
+}
+
/// The root class of most Objective-C class hierarchies.
@immutable
class NSObject with Copyable {
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation_api_impls.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation_api_impls.dart
index 445e232..4f73c08 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation_api_impls.dart
+++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/foundation/foundation_api_impls.dart
@@ -52,7 +52,9 @@
BinaryMessenger? binaryMessenger,
InstanceManager? instanceManager,
}) : _binaryMessenger = binaryMessenger,
- object = NSObjectFlutterApiImpl(
+ object = NSObjectFlutterApiImpl(instanceManager: instanceManager),
+ url = NSUrlFlutterApiImpl(
+ binaryMessenger: binaryMessenger,
instanceManager: instanceManager,
);
@@ -76,6 +78,10 @@
@visibleForTesting
final NSObjectFlutterApiImpl object;
+ /// Flutter Api for [NSUrl].
+ @visibleForTesting
+ final NSUrlFlutterApiImpl url;
+
/// Ensures all the Flutter APIs have been set up to receive calls from native code.
void ensureSetUp() {
if (!_hasBeenSetUp) {
@@ -83,6 +89,7 @@
object,
binaryMessenger: _binaryMessenger,
);
+ NSUrlFlutterApi.setup(url, binaryMessenger: _binaryMessenger);
_hasBeenSetUp = true;
}
}
@@ -154,7 +161,7 @@
String keyPath,
int objectIdentifier,
List<NSKeyValueChangeKeyEnumData?> changeKeys,
- List<Object?> changeValues,
+ List<ObjectOrIdentifier?> changeValues,
) {
final void Function(String, NSObject, Map<NSKeyValueChangeKey, Object?>)?
function = _getObject(identifier).observeValue;
@@ -163,11 +170,20 @@
instanceManager.getInstanceWithWeakReference(objectIdentifier)!
as NSObject,
Map<NSKeyValueChangeKey, Object?>.fromIterables(
- changeKeys.map<NSKeyValueChangeKey>(
- (NSKeyValueChangeKeyEnumData? data) {
- return data!.toNSKeyValueChangeKey();
- },
- ), changeValues),
+ changeKeys.map<NSKeyValueChangeKey>(
+ (NSKeyValueChangeKeyEnumData? data) {
+ return data!.toNSKeyValueChangeKey();
+ },
+ ),
+ changeValues.map<Object?>((ObjectOrIdentifier? value) {
+ if (value != null && value.isIdentifier) {
+ return instanceManager.getInstanceWithWeakReference(
+ value.value! as int,
+ );
+ }
+ return value?.value;
+ }),
+ ),
);
}
@@ -176,3 +192,60 @@
instanceManager.remove(identifier);
}
}
+
+/// Host api implementation for [NSUrl].
+class NSUrlHostApiImpl extends NSUrlHostApi {
+ /// Constructs an [NSUrlHostApiImpl].
+ NSUrlHostApiImpl({
+ this.binaryMessenger,
+ InstanceManager? instanceManager,
+ }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager,
+ super(binaryMessenger: binaryMessenger);
+
+ /// Sends binary data across the Flutter platform barrier.
+ ///
+ /// If it is null, the default BinaryMessenger will be used which routes to
+ /// the host platform.
+ final BinaryMessenger? binaryMessenger;
+
+ /// Maintains instances stored to communicate with Objective-C objects.
+ final InstanceManager instanceManager;
+
+ /// Calls [getAbsoluteString] with the ids of the provided object instances.
+ Future<String?> getAbsoluteStringFromInstances(NSUrl instance) {
+ return getAbsoluteString(instanceManager.getIdentifier(instance)!);
+ }
+}
+
+/// Flutter API implementation for [NSUrl].
+///
+/// This class may handle instantiating and adding Dart instances that are
+/// attached to a native instance or receiving callback methods from an
+/// overridden native class.
+class NSUrlFlutterApiImpl implements NSUrlFlutterApi {
+ /// Constructs a [NSUrlFlutterApiImpl].
+ NSUrlFlutterApiImpl({
+ this.binaryMessenger,
+ InstanceManager? instanceManager,
+ }) : instanceManager = instanceManager ?? NSObject.globalInstanceManager;
+
+ /// Receives binary data across the Flutter platform barrier.
+ ///
+ /// If it is null, the default BinaryMessenger will be used which routes to
+ /// the host platform.
+ final BinaryMessenger? binaryMessenger;
+
+ /// Maintains instances stored to communicate with native language objects.
+ final InstanceManager instanceManager;
+
+ @override
+ void create(int identifier) {
+ instanceManager.addHostCreatedInstance(
+ NSUrl.detached(
+ binaryMessenger: binaryMessenger,
+ instanceManager: instanceManager,
+ ),
+ identifier,
+ );
+ }
+}
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart
index 76d4a17..9ca4744 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart
+++ b/packages/webview_flutter/webview_flutter_wkwebview/lib/src/webkit_webview_controller.dart
@@ -130,6 +130,14 @@
NSKeyValueObservingOptions.newValue,
},
);
+
+ _webView.addObserver(
+ _webView,
+ keyPath: 'URL',
+ options: <NSKeyValueObservingOptions>{
+ NSKeyValueObservingOptions.newValue,
+ },
+ );
}
/// The WebKit WebView being controlled.
@@ -142,13 +150,30 @@
String keyPath,
NSObject object,
Map<NSKeyValueChangeKey, Object?> change,
- ) {
- final ProgressCallback? progressCallback =
- weakReference.target?._currentNavigationDelegate?._onProgress;
- if (progressCallback != null) {
- final double progress =
- change[NSKeyValueChangeKey.newValue]! as double;
- progressCallback((progress * 100).round());
+ ) async {
+ final WebKitWebViewController? controller = weakReference.target;
+ if (controller == null) {
+ return;
+ }
+
+ switch (keyPath) {
+ case 'estimatedProgress':
+ final ProgressCallback? progressCallback =
+ controller._currentNavigationDelegate?._onProgress;
+ if (progressCallback != null) {
+ final double progress =
+ change[NSKeyValueChangeKey.newValue]! as double;
+ progressCallback((progress * 100).round());
+ }
+ break;
+ case 'URL':
+ final UrlChangeCallback? urlChangeCallback =
+ controller._currentNavigationDelegate?._onUrlChange;
+ if (urlChangeCallback != null) {
+ final NSUrl url = change[NSKeyValueChangeKey.newValue]! as NSUrl;
+ urlChangeCallback(UrlChange(url: await url.getAbsoluteString()));
+ }
+ break;
}
};
}),
@@ -691,6 +716,7 @@
ProgressCallback? _onProgress;
WebResourceErrorCallback? _onWebResourceError;
NavigationRequestCallback? _onNavigationRequest;
+ UrlChangeCallback? _onUrlChange;
@override
Future<void> setOnPageFinished(PageEventCallback onPageFinished) async {
@@ -720,4 +746,9 @@
) async {
_onNavigationRequest = onNavigationRequest;
}
+
+ @override
+ Future<void> setOnUrlChange(UrlChangeCallback onUrlChange) async {
+ _onUrlChange = onUrlChange;
+ }
}
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart b/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart
index 7e6c847..8dcbc2a 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart
+++ b/packages/webview_flutter/webview_flutter_wkwebview/pigeons/web_kit.dart
@@ -258,6 +258,17 @@
late List<Object?> propertyValues;
}
+/// An object that can represent either a value supported by
+/// `StandardMessageCodec`, a data class in this pigeon file, or an identifier
+/// of an object stored in an `InstanceManager`.
+class ObjectOrIdentifier {
+ late Object? value;
+
+ /// Whether value is an int that is used to retrieve an instance stored in an
+ /// `InstanceManager`.
+ late bool isIdentifier;
+}
+
/// Mirror of WKWebsiteDataStore.
///
/// See https://developer.apple.com/documentation/webkit/wkwebsitedatastore?language=objc.
@@ -536,7 +547,7 @@
// conform to `NSCopying`. This splits the map of properties into a list of
// keys and values with the ordered maintained.
List<NSKeyValueChangeKeyEnumData?> changeKeys,
- List<Object?> changeValues,
+ List<ObjectOrIdentifier> changeValues,
);
@ObjCSelector('disposeObjectWithIdentifier:')
@@ -646,3 +657,29 @@
@async
void setCookie(int identifier, NSHttpCookieData cookie);
}
+
+/// Host API for `NSUrl`.
+///
+/// This class may handle instantiating and adding native object instances that
+/// are attached to a Dart instance or method calls on the associated native
+/// class or an instance of the class.
+///
+/// See https://developer.apple.com/documentation/foundation/nsurl?language=objc.
+@HostApi(dartHostTestHandler: 'TestNSUrlHostApi')
+abstract class NSUrlHostApi {
+ @ObjCSelector('absoluteStringForNSURLWithIdentifier:')
+ String? getAbsoluteString(int identifier);
+}
+
+/// Flutter API for `NSUrl`.
+///
+/// This class may handle instantiating and adding Dart instances that are
+/// attached to a native instance or receiving callback methods from an
+/// overridden native class.
+///
+/// See https://developer.apple.com/documentation/foundation/nsurl?language=objc.
+@FlutterApi()
+abstract class NSUrlFlutterApi {
+ @ObjCSelector('createWithIdentifier:')
+ void create(int identifier);
+}
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml
index 6d32867..4c5c748 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml
+++ b/packages/webview_flutter/webview_flutter_wkwebview/pubspec.yaml
@@ -2,7 +2,7 @@
description: A Flutter plugin that provides a WebView widget based on Apple's WKWebView control.
repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_wkwebview
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22
-version: 3.2.4
+version: 3.3.0
environment:
sdk: ">=2.18.0 <4.0.0"
@@ -20,7 +20,7 @@
flutter:
sdk: flutter
path: ^1.8.0
- webview_flutter_platform_interface: ^2.0.0
+ webview_flutter_platform_interface: ^2.1.0
dev_dependencies:
build_runner: ^2.1.5
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.g.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.g.dart
index ce6ecb6..a9b27a0 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.g.dart
+++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/common/test_web_kit.g.dart
@@ -986,30 +986,33 @@
} else if (value is NSUrlRequestData) {
buffer.putUint8(133);
writeValue(buffer, value.encode());
- } else if (value is WKAudiovisualMediaTypeEnumData) {
+ } else if (value is ObjectOrIdentifier) {
buffer.putUint8(134);
writeValue(buffer, value.encode());
- } else if (value is WKFrameInfoData) {
+ } else if (value is WKAudiovisualMediaTypeEnumData) {
buffer.putUint8(135);
writeValue(buffer, value.encode());
- } else if (value is WKNavigationActionData) {
+ } else if (value is WKFrameInfoData) {
buffer.putUint8(136);
writeValue(buffer, value.encode());
- } else if (value is WKNavigationActionPolicyEnumData) {
+ } else if (value is WKNavigationActionData) {
buffer.putUint8(137);
writeValue(buffer, value.encode());
- } else if (value is WKScriptMessageData) {
+ } else if (value is WKNavigationActionPolicyEnumData) {
buffer.putUint8(138);
writeValue(buffer, value.encode());
- } else if (value is WKUserScriptData) {
+ } else if (value is WKScriptMessageData) {
buffer.putUint8(139);
writeValue(buffer, value.encode());
- } else if (value is WKUserScriptInjectionTimeEnumData) {
+ } else if (value is WKUserScriptData) {
buffer.putUint8(140);
writeValue(buffer, value.encode());
- } else if (value is WKWebsiteDataTypeEnumData) {
+ } else if (value is WKUserScriptInjectionTimeEnumData) {
buffer.putUint8(141);
writeValue(buffer, value.encode());
+ } else if (value is WKWebsiteDataTypeEnumData) {
+ buffer.putUint8(142);
+ writeValue(buffer, value.encode());
} else {
super.writeValue(buffer, value);
}
@@ -1031,20 +1034,22 @@
case 133:
return NSUrlRequestData.decode(readValue(buffer)!);
case 134:
- return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!);
+ return ObjectOrIdentifier.decode(readValue(buffer)!);
case 135:
- return WKFrameInfoData.decode(readValue(buffer)!);
+ return WKAudiovisualMediaTypeEnumData.decode(readValue(buffer)!);
case 136:
- return WKNavigationActionData.decode(readValue(buffer)!);
+ return WKFrameInfoData.decode(readValue(buffer)!);
case 137:
- return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!);
+ return WKNavigationActionData.decode(readValue(buffer)!);
case 138:
- return WKScriptMessageData.decode(readValue(buffer)!);
+ return WKNavigationActionPolicyEnumData.decode(readValue(buffer)!);
case 139:
- return WKUserScriptData.decode(readValue(buffer)!);
+ return WKScriptMessageData.decode(readValue(buffer)!);
case 140:
- return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!);
+ return WKUserScriptData.decode(readValue(buffer)!);
case 141:
+ return WKUserScriptInjectionTimeEnumData.decode(readValue(buffer)!);
+ case 142:
return WKWebsiteDataTypeEnumData.decode(readValue(buffer)!);
default:
return super.readValueOfType(type, buffer);
@@ -1664,3 +1669,43 @@
}
}
}
+
+/// Host API for `NSUrl`.
+///
+/// This class may handle instantiating and adding native object instances that
+/// are attached to a Dart instance or method calls on the associated native
+/// class or an instance of the class.
+///
+/// See https://developer.apple.com/documentation/foundation/nsurl?language=objc.
+abstract class TestNSUrlHostApi {
+ static TestDefaultBinaryMessengerBinding? get _testBinaryMessengerBinding =>
+ TestDefaultBinaryMessengerBinding.instance;
+ static const MessageCodec<Object?> codec = StandardMessageCodec();
+
+ String? getAbsoluteString(int identifier);
+
+ static void setup(TestNSUrlHostApi? api, {BinaryMessenger? binaryMessenger}) {
+ {
+ final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
+ 'dev.flutter.pigeon.NSUrlHostApi.getAbsoluteString', codec,
+ binaryMessenger: binaryMessenger);
+ if (api == null) {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel, null);
+ } else {
+ _testBinaryMessengerBinding!.defaultBinaryMessenger
+ .setMockDecodedMessageHandler<Object?>(channel,
+ (Object? message) async {
+ assert(message != null,
+ 'Argument for dev.flutter.pigeon.NSUrlHostApi.getAbsoluteString was null.');
+ final List<Object?> args = (message as List<Object?>?)!;
+ final int? arg_identifier = (args[0] as int?);
+ assert(arg_identifier != null,
+ 'Argument for dev.flutter.pigeon.NSUrlHostApi.getAbsoluteString was null, expected non-null int.');
+ final String? output = api.getAbsoluteString(arg_identifier!);
+ return <Object?>[output];
+ });
+ }
+ }
+ }
+}
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.dart
index b953620..a6e0427 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.dart
+++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.dart
@@ -17,6 +17,7 @@
@GenerateMocks(<Type>[
TestNSObjectHostApi,
+ TestNSUrlHostApi,
])
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
@@ -137,7 +138,9 @@
<NSKeyValueChangeKeyEnumData>[
NSKeyValueChangeKeyEnumData(value: NSKeyValueChangeKeyEnum.oldValue)
],
- <Object?>['value'],
+ <ObjectOrIdentifier?>[
+ ObjectOrIdentifier(isIdentifier: false, value: 'value'),
+ ],
);
expect(
@@ -152,6 +155,55 @@
);
});
+ test('observeValue returns object in an `InstanceManager`', () async {
+ final Completer<List<Object?>> argsCompleter =
+ Completer<List<Object?>>();
+
+ FoundationFlutterApis.instance = FoundationFlutterApis(
+ instanceManager: instanceManager,
+ );
+
+ object = NSObject.detached(
+ instanceManager: instanceManager,
+ observeValue: (
+ String keyPath,
+ NSObject object,
+ Map<NSKeyValueChangeKey, Object?> change,
+ ) {
+ argsCompleter.complete(<Object?>[keyPath, object, change]);
+ },
+ );
+ instanceManager.addHostCreatedInstance(object, 1);
+
+ final NSObject returnedObject = NSObject.detached(
+ instanceManager: instanceManager,
+ );
+ instanceManager.addHostCreatedInstance(returnedObject, 2);
+
+ FoundationFlutterApis.instance.object.observeValue(
+ 1,
+ 'keyPath',
+ 1,
+ <NSKeyValueChangeKeyEnumData>[
+ NSKeyValueChangeKeyEnumData(value: NSKeyValueChangeKeyEnum.oldValue)
+ ],
+ <ObjectOrIdentifier?>[
+ ObjectOrIdentifier(isIdentifier: true, value: 2),
+ ],
+ );
+
+ expect(
+ argsCompleter.future,
+ completion(<Object?>[
+ 'keyPath',
+ object,
+ <NSKeyValueChangeKey, Object?>{
+ NSKeyValueChangeKey.oldValue: returnedObject,
+ },
+ ]),
+ );
+ });
+
test('NSObjectFlutterApi.dispose', () {
FoundationFlutterApis.instance = FoundationFlutterApis(
instanceManager: instanceManager,
@@ -166,5 +218,32 @@
expect(instanceManager.containsIdentifier(1), isFalse);
});
});
+
+ group('NSUrl', () {
+ // Ensure the test host api is removed after each test run.
+ tearDown(() => TestNSUrlHostApi.setup(null));
+
+ test('getAbsoluteString', () async {
+ final MockTestNSUrlHostApi mockApi = MockTestNSUrlHostApi();
+ TestNSUrlHostApi.setup(mockApi);
+
+ final NSUrl url = NSUrl.detached(instanceManager: instanceManager);
+ instanceManager.addHostCreatedInstance(url, 0);
+
+ when(mockApi.getAbsoluteString(0)).thenReturn('myString');
+
+ expect(await url.getAbsoluteString(), 'myString');
+ });
+
+ test('Flutter API create', () {
+ final NSUrlFlutterApi flutterApi = NSUrlFlutterApiImpl(
+ instanceManager: instanceManager,
+ );
+
+ flutterApi.create(0);
+
+ expect(instanceManager.getInstanceWithWeakReference(0), isA<NSUrl>());
+ });
+ });
});
}
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.mocks.dart
index 81c919e..a648fc6 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.mocks.dart
+++ b/packages/webview_flutter/webview_flutter_wkwebview/test/src/foundation/foundation_test.mocks.dart
@@ -73,3 +73,19 @@
returnValueForMissingStub: null,
);
}
+
+/// A class which mocks [TestNSUrlHostApi].
+///
+/// See the documentation for Mockito's code generation for more information.
+class MockTestNSUrlHostApi extends _i1.Mock implements _i2.TestNSUrlHostApi {
+ MockTestNSUrlHostApi() {
+ _i1.throwOnMissingStub(this);
+ }
+
+ @override
+ String? getAbsoluteString(int? identifier) =>
+ (super.noSuchMethod(Invocation.method(
+ #getAbsoluteString,
+ [identifier],
+ )) as String?);
+}
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.dart
index abf3f79..dc7085b 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.dart
+++ b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.dart
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+import 'dart:async';
import 'dart:math';
// TODO(a14n): remove this import once Flutter 3.1 or later reaches stable (including flutter/flutter#104231)
// ignore: unnecessary_import
@@ -23,6 +24,7 @@
import 'webkit_webview_controller_test.mocks.dart';
@GenerateMocks(<Type>[
+ NSUrl,
UIScrollView,
WKPreferences,
WKUserContentController,
@@ -929,6 +931,70 @@
expect(callbackProgress, 0);
});
+ test('setPlatformNavigationDelegate onUrlChange', () async {
+ final MockWKWebView mockWebView = MockWKWebView();
+
+ late final void Function(
+ String keyPath,
+ NSObject object,
+ Map<NSKeyValueChangeKey, Object?> change,
+ ) webViewObserveValue;
+
+ final WebKitWebViewController controller = createControllerWithMocks(
+ createMockWebView: (
+ _, {
+ void Function(
+ String keyPath,
+ NSObject object,
+ Map<NSKeyValueChangeKey, Object?> change,
+ )? observeValue,
+ }) {
+ webViewObserveValue = observeValue!;
+ return mockWebView;
+ },
+ );
+
+ verify(
+ mockWebView.addObserver(
+ mockWebView,
+ keyPath: 'URL',
+ options: <NSKeyValueObservingOptions>{
+ NSKeyValueObservingOptions.newValue,
+ },
+ ),
+ );
+
+ final WebKitNavigationDelegate navigationDelegate =
+ WebKitNavigationDelegate(
+ const WebKitNavigationDelegateCreationParams(
+ webKitProxy: WebKitProxy(
+ createNavigationDelegate: CapturingNavigationDelegate.new,
+ createUIDelegate: WKUIDelegate.detached,
+ ),
+ ),
+ );
+
+ final Completer<UrlChange> urlChangeCompleter = Completer<UrlChange>();
+ navigationDelegate.setOnUrlChange(
+ (UrlChange change) => urlChangeCompleter.complete(change),
+ );
+
+ await controller.setPlatformNavigationDelegate(navigationDelegate);
+
+ final MockNSUrl mockNSUrl = MockNSUrl();
+ when(mockNSUrl.getAbsoluteString()).thenAnswer((_) {
+ return Future<String>.value('https://www.google.com');
+ });
+ webViewObserveValue(
+ 'URL',
+ mockWebView,
+ <NSKeyValueChangeKey, Object?>{NSKeyValueChangeKey.newValue: mockNSUrl},
+ );
+
+ final UrlChange urlChange = await urlChangeCompleter.future;
+ expect(urlChange.url, 'https://www.google.com');
+ });
+
test('webViewIdentifier', () {
final InstanceManager instanceManager = InstanceManager(
onWeakReferenceRemoved: (_) {},
diff --git a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.mocks.dart b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.mocks.dart
index 184d0a6..9eb0397 100644
--- a/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.mocks.dart
+++ b/packages/webview_flutter/webview_flutter_wkwebview/test/webkit_webview_controller_test.mocks.dart
@@ -3,15 +3,15 @@
// Do not manually edit this file.
// ignore_for_file: no_leading_underscores_for_library_prefixes
-import 'dart:async' as _i5;
-import 'dart:math' as _i2;
-import 'dart:ui' as _i6;
+import 'dart:async' as _i6;
+import 'dart:math' as _i3;
+import 'dart:ui' as _i7;
import 'package:mockito/mockito.dart' as _i1;
import 'package:webview_flutter_wkwebview/src/foundation/foundation.dart'
- as _i7;
-import 'package:webview_flutter_wkwebview/src/ui_kit/ui_kit.dart' as _i3;
-import 'package:webview_flutter_wkwebview/src/web_kit/web_kit.dart' as _i4;
+ as _i2;
+import 'package:webview_flutter_wkwebview/src/ui_kit/ui_kit.dart' as _i4;
+import 'package:webview_flutter_wkwebview/src/web_kit/web_kit.dart' as _i5;
// ignore_for_file: type=lint
// ignore_for_file: avoid_redundant_argument_values
@@ -24,9 +24,8 @@
// ignore_for_file: camel_case_types
// ignore_for_file: subtype_of_sealed_class
-class _FakePoint_0<T extends num> extends _i1.SmartFake
- implements _i2.Point<T> {
- _FakePoint_0(
+class _FakeNSObject_0 extends _i1.SmartFake implements _i2.NSObject {
+ _FakeNSObject_0(
Object parent,
Invocation parentInvocation,
) : super(
@@ -35,8 +34,9 @@
);
}
-class _FakeUIScrollView_1 extends _i1.SmartFake implements _i3.UIScrollView {
- _FakeUIScrollView_1(
+class _FakePoint_1<T extends num> extends _i1.SmartFake
+ implements _i3.Point<T> {
+ _FakePoint_1(
Object parent,
Invocation parentInvocation,
) : super(
@@ -45,8 +45,8 @@
);
}
-class _FakeWKPreferences_2 extends _i1.SmartFake implements _i4.WKPreferences {
- _FakeWKPreferences_2(
+class _FakeUIScrollView_2 extends _i1.SmartFake implements _i4.UIScrollView {
+ _FakeUIScrollView_2(
Object parent,
Invocation parentInvocation,
) : super(
@@ -55,9 +55,8 @@
);
}
-class _FakeWKUserContentController_3 extends _i1.SmartFake
- implements _i4.WKUserContentController {
- _FakeWKUserContentController_3(
+class _FakeWKPreferences_3 extends _i1.SmartFake implements _i5.WKPreferences {
+ _FakeWKPreferences_3(
Object parent,
Invocation parentInvocation,
) : super(
@@ -66,9 +65,9 @@
);
}
-class _FakeWKHttpCookieStore_4 extends _i1.SmartFake
- implements _i4.WKHttpCookieStore {
- _FakeWKHttpCookieStore_4(
+class _FakeWKUserContentController_4 extends _i1.SmartFake
+ implements _i5.WKUserContentController {
+ _FakeWKUserContentController_4(
Object parent,
Invocation parentInvocation,
) : super(
@@ -77,9 +76,9 @@
);
}
-class _FakeWKWebsiteDataStore_5 extends _i1.SmartFake
- implements _i4.WKWebsiteDataStore {
- _FakeWKWebsiteDataStore_5(
+class _FakeWKHttpCookieStore_5 extends _i1.SmartFake
+ implements _i5.WKHttpCookieStore {
+ _FakeWKHttpCookieStore_5(
Object parent,
Invocation parentInvocation,
) : super(
@@ -88,9 +87,9 @@
);
}
-class _FakeWKWebViewConfiguration_6 extends _i1.SmartFake
- implements _i4.WKWebViewConfiguration {
- _FakeWKWebViewConfiguration_6(
+class _FakeWKWebsiteDataStore_6 extends _i1.SmartFake
+ implements _i5.WKWebsiteDataStore {
+ _FakeWKWebsiteDataStore_6(
Object parent,
Invocation parentInvocation,
) : super(
@@ -99,8 +98,9 @@
);
}
-class _FakeWKWebView_7 extends _i1.SmartFake implements _i4.WKWebView {
- _FakeWKWebView_7(
+class _FakeWKWebViewConfiguration_7 extends _i1.SmartFake
+ implements _i5.WKWebViewConfiguration {
+ _FakeWKWebViewConfiguration_7(
Object parent,
Invocation parentInvocation,
) : super(
@@ -109,85 +109,159 @@
);
}
+class _FakeWKWebView_8 extends _i1.SmartFake implements _i5.WKWebView {
+ _FakeWKWebView_8(
+ Object parent,
+ Invocation parentInvocation,
+ ) : super(
+ parent,
+ parentInvocation,
+ );
+}
+
+/// A class which mocks [NSUrl].
+///
+/// See the documentation for Mockito's code generation for more information.
+class MockNSUrl extends _i1.Mock implements _i2.NSUrl {
+ MockNSUrl() {
+ _i1.throwOnMissingStub(this);
+ }
+
+ @override
+ _i6.Future<String?> getAbsoluteString() => (super.noSuchMethod(
+ Invocation.method(
+ #getAbsoluteString,
+ [],
+ ),
+ returnValue: _i6.Future<String?>.value(),
+ ) as _i6.Future<String?>);
+ @override
+ _i2.NSObject copy() => (super.noSuchMethod(
+ Invocation.method(
+ #copy,
+ [],
+ ),
+ returnValue: _FakeNSObject_0(
+ this,
+ Invocation.method(
+ #copy,
+ [],
+ ),
+ ),
+ ) as _i2.NSObject);
+ @override
+ _i6.Future<void> addObserver(
+ _i2.NSObject? observer, {
+ required String? keyPath,
+ required Set<_i2.NSKeyValueObservingOptions>? options,
+ }) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #addObserver,
+ [observer],
+ {
+ #keyPath: keyPath,
+ #options: options,
+ },
+ ),
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
+ @override
+ _i6.Future<void> removeObserver(
+ _i2.NSObject? observer, {
+ required String? keyPath,
+ }) =>
+ (super.noSuchMethod(
+ Invocation.method(
+ #removeObserver,
+ [observer],
+ {#keyPath: keyPath},
+ ),
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
+}
+
/// A class which mocks [UIScrollView].
///
/// See the documentation for Mockito's code generation for more information.
// ignore: must_be_immutable
-class MockUIScrollView extends _i1.Mock implements _i3.UIScrollView {
+class MockUIScrollView extends _i1.Mock implements _i4.UIScrollView {
MockUIScrollView() {
_i1.throwOnMissingStub(this);
}
@override
- _i5.Future<_i2.Point<double>> getContentOffset() => (super.noSuchMethod(
+ _i6.Future<_i3.Point<double>> getContentOffset() => (super.noSuchMethod(
Invocation.method(
#getContentOffset,
[],
),
- returnValue: _i5.Future<_i2.Point<double>>.value(_FakePoint_0<double>(
+ returnValue: _i6.Future<_i3.Point<double>>.value(_FakePoint_1<double>(
this,
Invocation.method(
#getContentOffset,
[],
),
)),
- ) as _i5.Future<_i2.Point<double>>);
+ ) as _i6.Future<_i3.Point<double>>);
@override
- _i5.Future<void> scrollBy(_i2.Point<double>? offset) => (super.noSuchMethod(
+ _i6.Future<void> scrollBy(_i3.Point<double>? offset) => (super.noSuchMethod(
Invocation.method(
#scrollBy,
[offset],
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<void> setContentOffset(_i2.Point<double>? offset) =>
+ _i6.Future<void> setContentOffset(_i3.Point<double>? offset) =>
(super.noSuchMethod(
Invocation.method(
#setContentOffset,
[offset],
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i3.UIScrollView copy() => (super.noSuchMethod(
+ _i4.UIScrollView copy() => (super.noSuchMethod(
Invocation.method(
#copy,
[],
),
- returnValue: _FakeUIScrollView_1(
+ returnValue: _FakeUIScrollView_2(
this,
Invocation.method(
#copy,
[],
),
),
- ) as _i3.UIScrollView);
+ ) as _i4.UIScrollView);
@override
- _i5.Future<void> setBackgroundColor(_i6.Color? color) => (super.noSuchMethod(
+ _i6.Future<void> setBackgroundColor(_i7.Color? color) => (super.noSuchMethod(
Invocation.method(
#setBackgroundColor,
[color],
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<void> setOpaque(bool? opaque) => (super.noSuchMethod(
+ _i6.Future<void> setOpaque(bool? opaque) => (super.noSuchMethod(
Invocation.method(
#setOpaque,
[opaque],
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<void> addObserver(
- _i7.NSObject? observer, {
+ _i6.Future<void> addObserver(
+ _i2.NSObject? observer, {
required String? keyPath,
- required Set<_i7.NSKeyValueObservingOptions>? options,
+ required Set<_i2.NSKeyValueObservingOptions>? options,
}) =>
(super.noSuchMethod(
Invocation.method(
@@ -198,12 +272,12 @@
#options: options,
},
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<void> removeObserver(
- _i7.NSObject? observer, {
+ _i6.Future<void> removeObserver(
+ _i2.NSObject? observer, {
required String? keyPath,
}) =>
(super.noSuchMethod(
@@ -212,48 +286,48 @@
[observer],
{#keyPath: keyPath},
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
}
/// A class which mocks [WKPreferences].
///
/// See the documentation for Mockito's code generation for more information.
// ignore: must_be_immutable
-class MockWKPreferences extends _i1.Mock implements _i4.WKPreferences {
+class MockWKPreferences extends _i1.Mock implements _i5.WKPreferences {
MockWKPreferences() {
_i1.throwOnMissingStub(this);
}
@override
- _i5.Future<void> setJavaScriptEnabled(bool? enabled) => (super.noSuchMethod(
+ _i6.Future<void> setJavaScriptEnabled(bool? enabled) => (super.noSuchMethod(
Invocation.method(
#setJavaScriptEnabled,
[enabled],
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i4.WKPreferences copy() => (super.noSuchMethod(
+ _i5.WKPreferences copy() => (super.noSuchMethod(
Invocation.method(
#copy,
[],
),
- returnValue: _FakeWKPreferences_2(
+ returnValue: _FakeWKPreferences_3(
this,
Invocation.method(
#copy,
[],
),
),
- ) as _i4.WKPreferences);
+ ) as _i5.WKPreferences);
@override
- _i5.Future<void> addObserver(
- _i7.NSObject? observer, {
+ _i6.Future<void> addObserver(
+ _i2.NSObject? observer, {
required String? keyPath,
- required Set<_i7.NSKeyValueObservingOptions>? options,
+ required Set<_i2.NSKeyValueObservingOptions>? options,
}) =>
(super.noSuchMethod(
Invocation.method(
@@ -264,12 +338,12 @@
#options: options,
},
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<void> removeObserver(
- _i7.NSObject? observer, {
+ _i6.Future<void> removeObserver(
+ _i2.NSObject? observer, {
required String? keyPath,
}) =>
(super.noSuchMethod(
@@ -278,9 +352,9 @@
[observer],
{#keyPath: keyPath},
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
}
/// A class which mocks [WKUserContentController].
@@ -288,14 +362,14 @@
/// See the documentation for Mockito's code generation for more information.
// ignore: must_be_immutable
class MockWKUserContentController extends _i1.Mock
- implements _i4.WKUserContentController {
+ implements _i5.WKUserContentController {
MockWKUserContentController() {
_i1.throwOnMissingStub(this);
}
@override
- _i5.Future<void> addScriptMessageHandler(
- _i4.WKScriptMessageHandler? handler,
+ _i6.Future<void> addScriptMessageHandler(
+ _i5.WKScriptMessageHandler? handler,
String? name,
) =>
(super.noSuchMethod(
@@ -306,66 +380,66 @@
name,
],
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<void> removeScriptMessageHandler(String? name) =>
+ _i6.Future<void> removeScriptMessageHandler(String? name) =>
(super.noSuchMethod(
Invocation.method(
#removeScriptMessageHandler,
[name],
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<void> removeAllScriptMessageHandlers() => (super.noSuchMethod(
+ _i6.Future<void> removeAllScriptMessageHandlers() => (super.noSuchMethod(
Invocation.method(
#removeAllScriptMessageHandlers,
[],
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<void> addUserScript(_i4.WKUserScript? userScript) =>
+ _i6.Future<void> addUserScript(_i5.WKUserScript? userScript) =>
(super.noSuchMethod(
Invocation.method(
#addUserScript,
[userScript],
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<void> removeAllUserScripts() => (super.noSuchMethod(
+ _i6.Future<void> removeAllUserScripts() => (super.noSuchMethod(
Invocation.method(
#removeAllUserScripts,
[],
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i4.WKUserContentController copy() => (super.noSuchMethod(
+ _i5.WKUserContentController copy() => (super.noSuchMethod(
Invocation.method(
#copy,
[],
),
- returnValue: _FakeWKUserContentController_3(
+ returnValue: _FakeWKUserContentController_4(
this,
Invocation.method(
#copy,
[],
),
),
- ) as _i4.WKUserContentController);
+ ) as _i5.WKUserContentController);
@override
- _i5.Future<void> addObserver(
- _i7.NSObject? observer, {
+ _i6.Future<void> addObserver(
+ _i2.NSObject? observer, {
required String? keyPath,
- required Set<_i7.NSKeyValueObservingOptions>? options,
+ required Set<_i2.NSKeyValueObservingOptions>? options,
}) =>
(super.noSuchMethod(
Invocation.method(
@@ -376,12 +450,12 @@
#options: options,
},
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<void> removeObserver(
- _i7.NSObject? observer, {
+ _i6.Future<void> removeObserver(
+ _i2.NSObject? observer, {
required String? keyPath,
}) =>
(super.noSuchMethod(
@@ -390,9 +464,9 @@
[observer],
{#keyPath: keyPath},
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
}
/// A class which mocks [WKWebsiteDataStore].
@@ -400,22 +474,22 @@
/// See the documentation for Mockito's code generation for more information.
// ignore: must_be_immutable
class MockWKWebsiteDataStore extends _i1.Mock
- implements _i4.WKWebsiteDataStore {
+ implements _i5.WKWebsiteDataStore {
MockWKWebsiteDataStore() {
_i1.throwOnMissingStub(this);
}
@override
- _i4.WKHttpCookieStore get httpCookieStore => (super.noSuchMethod(
+ _i5.WKHttpCookieStore get httpCookieStore => (super.noSuchMethod(
Invocation.getter(#httpCookieStore),
- returnValue: _FakeWKHttpCookieStore_4(
+ returnValue: _FakeWKHttpCookieStore_5(
this,
Invocation.getter(#httpCookieStore),
),
- ) as _i4.WKHttpCookieStore);
+ ) as _i5.WKHttpCookieStore);
@override
- _i5.Future<bool> removeDataOfTypes(
- Set<_i4.WKWebsiteDataType>? dataTypes,
+ _i6.Future<bool> removeDataOfTypes(
+ Set<_i5.WKWebsiteDataType>? dataTypes,
DateTime? since,
) =>
(super.noSuchMethod(
@@ -426,27 +500,27 @@
since,
],
),
- returnValue: _i5.Future<bool>.value(false),
- ) as _i5.Future<bool>);
+ returnValue: _i6.Future<bool>.value(false),
+ ) as _i6.Future<bool>);
@override
- _i4.WKWebsiteDataStore copy() => (super.noSuchMethod(
+ _i5.WKWebsiteDataStore copy() => (super.noSuchMethod(
Invocation.method(
#copy,
[],
),
- returnValue: _FakeWKWebsiteDataStore_5(
+ returnValue: _FakeWKWebsiteDataStore_6(
this,
Invocation.method(
#copy,
[],
),
),
- ) as _i4.WKWebsiteDataStore);
+ ) as _i5.WKWebsiteDataStore);
@override
- _i5.Future<void> addObserver(
- _i7.NSObject? observer, {
+ _i6.Future<void> addObserver(
+ _i2.NSObject? observer, {
required String? keyPath,
- required Set<_i7.NSKeyValueObservingOptions>? options,
+ required Set<_i2.NSKeyValueObservingOptions>? options,
}) =>
(super.noSuchMethod(
Invocation.method(
@@ -457,12 +531,12 @@
#options: options,
},
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<void> removeObserver(
- _i7.NSObject? observer, {
+ _i6.Future<void> removeObserver(
+ _i2.NSObject? observer, {
required String? keyPath,
}) =>
(super.noSuchMethod(
@@ -471,84 +545,84 @@
[observer],
{#keyPath: keyPath},
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
}
/// A class which mocks [WKWebView].
///
/// See the documentation for Mockito's code generation for more information.
// ignore: must_be_immutable
-class MockWKWebView extends _i1.Mock implements _i4.WKWebView {
+class MockWKWebView extends _i1.Mock implements _i5.WKWebView {
MockWKWebView() {
_i1.throwOnMissingStub(this);
}
@override
- _i4.WKWebViewConfiguration get configuration => (super.noSuchMethod(
+ _i5.WKWebViewConfiguration get configuration => (super.noSuchMethod(
Invocation.getter(#configuration),
- returnValue: _FakeWKWebViewConfiguration_6(
+ returnValue: _FakeWKWebViewConfiguration_7(
this,
Invocation.getter(#configuration),
),
- ) as _i4.WKWebViewConfiguration);
+ ) as _i5.WKWebViewConfiguration);
@override
- _i3.UIScrollView get scrollView => (super.noSuchMethod(
+ _i4.UIScrollView get scrollView => (super.noSuchMethod(
Invocation.getter(#scrollView),
- returnValue: _FakeUIScrollView_1(
+ returnValue: _FakeUIScrollView_2(
this,
Invocation.getter(#scrollView),
),
- ) as _i3.UIScrollView);
+ ) as _i4.UIScrollView);
@override
- _i5.Future<void> setUIDelegate(_i4.WKUIDelegate? delegate) =>
+ _i6.Future<void> setUIDelegate(_i5.WKUIDelegate? delegate) =>
(super.noSuchMethod(
Invocation.method(
#setUIDelegate,
[delegate],
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<void> setNavigationDelegate(_i4.WKNavigationDelegate? delegate) =>
+ _i6.Future<void> setNavigationDelegate(_i5.WKNavigationDelegate? delegate) =>
(super.noSuchMethod(
Invocation.method(
#setNavigationDelegate,
[delegate],
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<String?> getUrl() => (super.noSuchMethod(
+ _i6.Future<String?> getUrl() => (super.noSuchMethod(
Invocation.method(
#getUrl,
[],
),
- returnValue: _i5.Future<String?>.value(),
- ) as _i5.Future<String?>);
+ returnValue: _i6.Future<String?>.value(),
+ ) as _i6.Future<String?>);
@override
- _i5.Future<double> getEstimatedProgress() => (super.noSuchMethod(
+ _i6.Future<double> getEstimatedProgress() => (super.noSuchMethod(
Invocation.method(
#getEstimatedProgress,
[],
),
- returnValue: _i5.Future<double>.value(0.0),
- ) as _i5.Future<double>);
+ returnValue: _i6.Future<double>.value(0.0),
+ ) as _i6.Future<double>);
@override
- _i5.Future<void> loadRequest(_i7.NSUrlRequest? request) =>
+ _i6.Future<void> loadRequest(_i2.NSUrlRequest? request) =>
(super.noSuchMethod(
Invocation.method(
#loadRequest,
[request],
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<void> loadHtmlString(
+ _i6.Future<void> loadHtmlString(
String? string, {
String? baseUrl,
}) =>
@@ -558,11 +632,11 @@
[string],
{#baseUrl: baseUrl},
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<void> loadFileUrl(
+ _i6.Future<void> loadFileUrl(
String? url, {
required String? readAccessUrl,
}) =>
@@ -572,134 +646,134 @@
[url],
{#readAccessUrl: readAccessUrl},
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<void> loadFlutterAsset(String? key) => (super.noSuchMethod(
+ _i6.Future<void> loadFlutterAsset(String? key) => (super.noSuchMethod(
Invocation.method(
#loadFlutterAsset,
[key],
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<bool> canGoBack() => (super.noSuchMethod(
+ _i6.Future<bool> canGoBack() => (super.noSuchMethod(
Invocation.method(
#canGoBack,
[],
),
- returnValue: _i5.Future<bool>.value(false),
- ) as _i5.Future<bool>);
+ returnValue: _i6.Future<bool>.value(false),
+ ) as _i6.Future<bool>);
@override
- _i5.Future<bool> canGoForward() => (super.noSuchMethod(
+ _i6.Future<bool> canGoForward() => (super.noSuchMethod(
Invocation.method(
#canGoForward,
[],
),
- returnValue: _i5.Future<bool>.value(false),
- ) as _i5.Future<bool>);
+ returnValue: _i6.Future<bool>.value(false),
+ ) as _i6.Future<bool>);
@override
- _i5.Future<void> goBack() => (super.noSuchMethod(
+ _i6.Future<void> goBack() => (super.noSuchMethod(
Invocation.method(
#goBack,
[],
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<void> goForward() => (super.noSuchMethod(
+ _i6.Future<void> goForward() => (super.noSuchMethod(
Invocation.method(
#goForward,
[],
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<void> reload() => (super.noSuchMethod(
+ _i6.Future<void> reload() => (super.noSuchMethod(
Invocation.method(
#reload,
[],
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<String?> getTitle() => (super.noSuchMethod(
+ _i6.Future<String?> getTitle() => (super.noSuchMethod(
Invocation.method(
#getTitle,
[],
),
- returnValue: _i5.Future<String?>.value(),
- ) as _i5.Future<String?>);
+ returnValue: _i6.Future<String?>.value(),
+ ) as _i6.Future<String?>);
@override
- _i5.Future<void> setAllowsBackForwardNavigationGestures(bool? allow) =>
+ _i6.Future<void> setAllowsBackForwardNavigationGestures(bool? allow) =>
(super.noSuchMethod(
Invocation.method(
#setAllowsBackForwardNavigationGestures,
[allow],
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<void> setCustomUserAgent(String? userAgent) => (super.noSuchMethod(
+ _i6.Future<void> setCustomUserAgent(String? userAgent) => (super.noSuchMethod(
Invocation.method(
#setCustomUserAgent,
[userAgent],
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<Object?> evaluateJavaScript(String? javaScriptString) =>
+ _i6.Future<Object?> evaluateJavaScript(String? javaScriptString) =>
(super.noSuchMethod(
Invocation.method(
#evaluateJavaScript,
[javaScriptString],
),
- returnValue: _i5.Future<Object?>.value(),
- ) as _i5.Future<Object?>);
+ returnValue: _i6.Future<Object?>.value(),
+ ) as _i6.Future<Object?>);
@override
- _i4.WKWebView copy() => (super.noSuchMethod(
+ _i5.WKWebView copy() => (super.noSuchMethod(
Invocation.method(
#copy,
[],
),
- returnValue: _FakeWKWebView_7(
+ returnValue: _FakeWKWebView_8(
this,
Invocation.method(
#copy,
[],
),
),
- ) as _i4.WKWebView);
+ ) as _i5.WKWebView);
@override
- _i5.Future<void> setBackgroundColor(_i6.Color? color) => (super.noSuchMethod(
+ _i6.Future<void> setBackgroundColor(_i7.Color? color) => (super.noSuchMethod(
Invocation.method(
#setBackgroundColor,
[color],
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<void> setOpaque(bool? opaque) => (super.noSuchMethod(
+ _i6.Future<void> setOpaque(bool? opaque) => (super.noSuchMethod(
Invocation.method(
#setOpaque,
[opaque],
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<void> addObserver(
- _i7.NSObject? observer, {
+ _i6.Future<void> addObserver(
+ _i2.NSObject? observer, {
required String? keyPath,
- required Set<_i7.NSKeyValueObservingOptions>? options,
+ required Set<_i2.NSKeyValueObservingOptions>? options,
}) =>
(super.noSuchMethod(
Invocation.method(
@@ -710,12 +784,12 @@
#options: options,
},
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<void> removeObserver(
- _i7.NSObject? observer, {
+ _i6.Future<void> removeObserver(
+ _i2.NSObject? observer, {
required String? keyPath,
}) =>
(super.noSuchMethod(
@@ -724,9 +798,9 @@
[observer],
{#keyPath: keyPath},
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
}
/// A class which mocks [WKWebViewConfiguration].
@@ -734,75 +808,75 @@
/// See the documentation for Mockito's code generation for more information.
// ignore: must_be_immutable
class MockWKWebViewConfiguration extends _i1.Mock
- implements _i4.WKWebViewConfiguration {
+ implements _i5.WKWebViewConfiguration {
MockWKWebViewConfiguration() {
_i1.throwOnMissingStub(this);
}
@override
- _i4.WKUserContentController get userContentController => (super.noSuchMethod(
+ _i5.WKUserContentController get userContentController => (super.noSuchMethod(
Invocation.getter(#userContentController),
- returnValue: _FakeWKUserContentController_3(
+ returnValue: _FakeWKUserContentController_4(
this,
Invocation.getter(#userContentController),
),
- ) as _i4.WKUserContentController);
+ ) as _i5.WKUserContentController);
@override
- _i4.WKPreferences get preferences => (super.noSuchMethod(
+ _i5.WKPreferences get preferences => (super.noSuchMethod(
Invocation.getter(#preferences),
- returnValue: _FakeWKPreferences_2(
+ returnValue: _FakeWKPreferences_3(
this,
Invocation.getter(#preferences),
),
- ) as _i4.WKPreferences);
+ ) as _i5.WKPreferences);
@override
- _i4.WKWebsiteDataStore get websiteDataStore => (super.noSuchMethod(
+ _i5.WKWebsiteDataStore get websiteDataStore => (super.noSuchMethod(
Invocation.getter(#websiteDataStore),
- returnValue: _FakeWKWebsiteDataStore_5(
+ returnValue: _FakeWKWebsiteDataStore_6(
this,
Invocation.getter(#websiteDataStore),
),
- ) as _i4.WKWebsiteDataStore);
+ ) as _i5.WKWebsiteDataStore);
@override
- _i5.Future<void> setAllowsInlineMediaPlayback(bool? allow) =>
+ _i6.Future<void> setAllowsInlineMediaPlayback(bool? allow) =>
(super.noSuchMethod(
Invocation.method(
#setAllowsInlineMediaPlayback,
[allow],
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<void> setMediaTypesRequiringUserActionForPlayback(
- Set<_i4.WKAudiovisualMediaType>? types) =>
+ _i6.Future<void> setMediaTypesRequiringUserActionForPlayback(
+ Set<_i5.WKAudiovisualMediaType>? types) =>
(super.noSuchMethod(
Invocation.method(
#setMediaTypesRequiringUserActionForPlayback,
[types],
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i4.WKWebViewConfiguration copy() => (super.noSuchMethod(
+ _i5.WKWebViewConfiguration copy() => (super.noSuchMethod(
Invocation.method(
#copy,
[],
),
- returnValue: _FakeWKWebViewConfiguration_6(
+ returnValue: _FakeWKWebViewConfiguration_7(
this,
Invocation.method(
#copy,
[],
),
),
- ) as _i4.WKWebViewConfiguration);
+ ) as _i5.WKWebViewConfiguration);
@override
- _i5.Future<void> addObserver(
- _i7.NSObject? observer, {
+ _i6.Future<void> addObserver(
+ _i2.NSObject? observer, {
required String? keyPath,
- required Set<_i7.NSKeyValueObservingOptions>? options,
+ required Set<_i2.NSKeyValueObservingOptions>? options,
}) =>
(super.noSuchMethod(
Invocation.method(
@@ -813,12 +887,12 @@
#options: options,
},
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
@override
- _i5.Future<void> removeObserver(
- _i7.NSObject? observer, {
+ _i6.Future<void> removeObserver(
+ _i2.NSObject? observer, {
required String? keyPath,
}) =>
(super.noSuchMethod(
@@ -827,7 +901,7 @@
[observer],
{#keyPath: keyPath},
),
- returnValue: _i5.Future<void>.value(),
- returnValueForMissingStub: _i5.Future<void>.value(),
- ) as _i5.Future<void>);
+ returnValue: _i6.Future<void>.value(),
+ returnValueForMissingStub: _i6.Future<void>.value(),
+ ) as _i6.Future<void>);
}