[webview_flutter_android] Updates `pigeon` version to support null safety (#5395)
diff --git a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md
index fb5a2b8..c9d0239 100644
--- a/packages/webview_flutter/webview_flutter_android/CHANGELOG.md
+++ b/packages/webview_flutter/webview_flutter_android/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 2.8.6
+
+* Updates pigeon developer dependency to the latest version which adds support for null safety.
+
## 2.8.5
* Migrates deprecated `Scaffold.showSnackBar` to `ScaffoldMessenger` in example app.
diff --git a/packages/webview_flutter/webview_flutter_android/README.md b/packages/webview_flutter/webview_flutter_android/README.md
index 020f1fc..04cbde2 100644
--- a/packages/webview_flutter/webview_flutter_android/README.md
+++ b/packages/webview_flutter/webview_flutter_android/README.md
@@ -9,7 +9,10 @@
## Contributing
-This package uses [pigeon][3] to generate the communication layer between Flutter and the host platform (Android). The communication interface is defined in the `pigeons/android_webview.dart` file. After editing the communication interface regenerate the communication layer by running the `./generatePigeons.sh` shell script.
+This package uses [pigeon][3] to generate the communication layer between Flutter and the host
+platform (Android). The communication interface is defined in the `pigeons/android_webview.dart`
+file. After editing the communication interface regenerate the communication layer by running
+`flutter pub run pigeon --input pigeons/android_webview.dart`.
Due to [flutter/flutter#97744](https://github.com/flutter/flutter/issues/97744), the generated test
pigeon file needs one of its imports updated to properly work with `mockito`.
@@ -26,7 +29,8 @@
import 'package:webview_flutter_android/src/android_webview.pigeon.dart';
```
-Besides [pigeon][3] this package also uses [mockito][4] to generate mock objects for testing purposes. To generate the mock objects run the following command:
+Besides [pigeon][3] this package also uses [mockito][4] to generate mock objects for testing
+purposes. To generate the mock objects run the following command:
```bash
flutter packages pub run build_runner build --delete-conflicting-outputs
```
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 afca5ee..2e16331 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,12 +1,14 @@
// 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 (v1.0.9), do not edit directly.
+// Autogenerated from Pigeon (v3.0.3), do not edit directly.
// See also: https://pub.dev/packages/pigeon
package io.flutter.plugins.webviewflutter;
+import android.util.Log;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import io.flutter.plugin.common.BasicMessageChannel;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.MessageCodec;
@@ -25,66 +27,140 @@
/** Generated class from Pigeon that represents data sent in messages. */
public static class WebResourceRequestData {
- private String url;
+ private @NonNull String url;
- public String getUrl() {
+ public @NonNull String getUrl() {
return url;
}
- public void setUrl(String setterArg) {
+ public void setUrl(@NonNull String setterArg) {
+ if (setterArg == null) {
+ throw new IllegalStateException("Nonnull field \"url\" is null.");
+ }
this.url = setterArg;
}
- private Boolean isForMainFrame;
+ private @NonNull Boolean isForMainFrame;
- public Boolean getIsForMainFrame() {
+ public @NonNull Boolean getIsForMainFrame() {
return isForMainFrame;
}
- public void setIsForMainFrame(Boolean setterArg) {
+ public void setIsForMainFrame(@NonNull Boolean setterArg) {
+ if (setterArg == null) {
+ throw new IllegalStateException("Nonnull field \"isForMainFrame\" is null.");
+ }
this.isForMainFrame = setterArg;
}
- private Boolean isRedirect;
+ private @Nullable Boolean isRedirect;
- public Boolean getIsRedirect() {
+ public @Nullable Boolean getIsRedirect() {
return isRedirect;
}
- public void setIsRedirect(Boolean setterArg) {
+ public void setIsRedirect(@Nullable Boolean setterArg) {
this.isRedirect = setterArg;
}
- private Boolean hasGesture;
+ private @NonNull Boolean hasGesture;
- public Boolean getHasGesture() {
+ public @NonNull Boolean getHasGesture() {
return hasGesture;
}
- public void setHasGesture(Boolean setterArg) {
+ public void setHasGesture(@NonNull Boolean setterArg) {
+ if (setterArg == null) {
+ throw new IllegalStateException("Nonnull field \"hasGesture\" is null.");
+ }
this.hasGesture = setterArg;
}
- private String method;
+ private @NonNull String method;
- public String getMethod() {
+ public @NonNull String getMethod() {
return method;
}
- public void setMethod(String setterArg) {
+ public void setMethod(@NonNull String setterArg) {
+ if (setterArg == null) {
+ throw new IllegalStateException("Nonnull field \"method\" is null.");
+ }
this.method = setterArg;
}
- private Map<String, String> requestHeaders;
+ private @NonNull Map<String, String> requestHeaders;
- public Map<String, String> getRequestHeaders() {
+ public @NonNull Map<String, String> getRequestHeaders() {
return requestHeaders;
}
- public void setRequestHeaders(Map<String, String> setterArg) {
+ public void setRequestHeaders(@NonNull Map<String, String> setterArg) {
+ if (setterArg == null) {
+ throw new IllegalStateException("Nonnull field \"requestHeaders\" is null.");
+ }
this.requestHeaders = setterArg;
}
+ /** Constructor is private to enforce null safety; use Builder. */
+ private WebResourceRequestData() {}
+
+ public static final class Builder {
+ private @Nullable String url;
+
+ public @NonNull Builder setUrl(@NonNull String setterArg) {
+ this.url = setterArg;
+ return this;
+ }
+
+ private @Nullable Boolean isForMainFrame;
+
+ public @NonNull Builder setIsForMainFrame(@NonNull Boolean setterArg) {
+ this.isForMainFrame = setterArg;
+ return this;
+ }
+
+ private @Nullable Boolean isRedirect;
+
+ public @NonNull Builder setIsRedirect(@Nullable Boolean setterArg) {
+ this.isRedirect = setterArg;
+ return this;
+ }
+
+ private @Nullable Boolean hasGesture;
+
+ public @NonNull Builder setHasGesture(@NonNull Boolean setterArg) {
+ this.hasGesture = setterArg;
+ return this;
+ }
+
+ private @Nullable String method;
+
+ public @NonNull Builder setMethod(@NonNull String setterArg) {
+ this.method = setterArg;
+ return this;
+ }
+
+ private @Nullable Map<String, String> requestHeaders;
+
+ public @NonNull Builder setRequestHeaders(@NonNull Map<String, String> setterArg) {
+ this.requestHeaders = setterArg;
+ return this;
+ }
+
+ public @NonNull WebResourceRequestData build() {
+ WebResourceRequestData pigeonReturn = new WebResourceRequestData();
+ pigeonReturn.setUrl(url);
+ pigeonReturn.setIsForMainFrame(isForMainFrame);
+ pigeonReturn.setIsRedirect(isRedirect);
+ pigeonReturn.setHasGesture(hasGesture);
+ pigeonReturn.setMethod(method);
+ pigeonReturn.setRequestHeaders(requestHeaders);
+ return pigeonReturn;
+ }
+ }
+
+ @NonNull
Map<String, Object> toMap() {
Map<String, Object> toMapResult = new HashMap<>();
toMapResult.put("url", url);
@@ -96,46 +172,79 @@
return toMapResult;
}
- static WebResourceRequestData fromMap(Map<String, Object> map) {
- WebResourceRequestData fromMapResult = new WebResourceRequestData();
+ static @NonNull WebResourceRequestData fromMap(@NonNull Map<String, Object> map) {
+ WebResourceRequestData pigeonResult = new WebResourceRequestData();
Object url = map.get("url");
- fromMapResult.url = (String) url;
+ pigeonResult.setUrl((String) url);
Object isForMainFrame = map.get("isForMainFrame");
- fromMapResult.isForMainFrame = (Boolean) isForMainFrame;
+ pigeonResult.setIsForMainFrame((Boolean) isForMainFrame);
Object isRedirect = map.get("isRedirect");
- fromMapResult.isRedirect = (Boolean) isRedirect;
+ pigeonResult.setIsRedirect((Boolean) isRedirect);
Object hasGesture = map.get("hasGesture");
- fromMapResult.hasGesture = (Boolean) hasGesture;
+ pigeonResult.setHasGesture((Boolean) hasGesture);
Object method = map.get("method");
- fromMapResult.method = (String) method;
+ pigeonResult.setMethod((String) method);
Object requestHeaders = map.get("requestHeaders");
- fromMapResult.requestHeaders = (Map<String, String>) requestHeaders;
- return fromMapResult;
+ pigeonResult.setRequestHeaders((Map<String, String>) requestHeaders);
+ return pigeonResult;
}
}
/** Generated class from Pigeon that represents data sent in messages. */
public static class WebResourceErrorData {
- private Long errorCode;
+ private @NonNull Long errorCode;
- public Long getErrorCode() {
+ public @NonNull Long getErrorCode() {
return errorCode;
}
- public void setErrorCode(Long setterArg) {
+ public void setErrorCode(@NonNull Long setterArg) {
+ if (setterArg == null) {
+ throw new IllegalStateException("Nonnull field \"errorCode\" is null.");
+ }
this.errorCode = setterArg;
}
- private String description;
+ private @NonNull String description;
- public String getDescription() {
+ public @NonNull String getDescription() {
return description;
}
- public void setDescription(String setterArg) {
+ public void setDescription(@NonNull String setterArg) {
+ if (setterArg == null) {
+ throw new IllegalStateException("Nonnull field \"description\" is null.");
+ }
this.description = setterArg;
}
+ /** Constructor is private to enforce null safety; use Builder. */
+ private WebResourceErrorData() {}
+
+ public static final class Builder {
+ private @Nullable Long errorCode;
+
+ public @NonNull Builder setErrorCode(@NonNull Long setterArg) {
+ this.errorCode = setterArg;
+ return this;
+ }
+
+ private @Nullable String description;
+
+ public @NonNull Builder setDescription(@NonNull String setterArg) {
+ this.description = setterArg;
+ return this;
+ }
+
+ public @NonNull WebResourceErrorData build() {
+ WebResourceErrorData pigeonReturn = new WebResourceErrorData();
+ pigeonReturn.setErrorCode(errorCode);
+ pigeonReturn.setDescription(description);
+ return pigeonReturn;
+ }
+ }
+
+ @NonNull
Map<String, Object> toMap() {
Map<String, Object> toMapResult = new HashMap<>();
toMapResult.put("errorCode", errorCode);
@@ -143,16 +252,16 @@
return toMapResult;
}
- static WebResourceErrorData fromMap(Map<String, Object> map) {
- WebResourceErrorData fromMapResult = new WebResourceErrorData();
+ static @NonNull WebResourceErrorData fromMap(@NonNull Map<String, Object> map) {
+ WebResourceErrorData pigeonResult = new WebResourceErrorData();
Object errorCode = map.get("errorCode");
- fromMapResult.errorCode =
+ pigeonResult.setErrorCode(
(errorCode == null)
? null
- : ((errorCode instanceof Integer) ? (Integer) errorCode : (Long) errorCode);
+ : ((errorCode instanceof Integer) ? (Integer) errorCode : (Long) errorCode));
Object description = map.get("description");
- fromMapResult.description = (String) description;
- return fromMapResult;
+ pigeonResult.setDescription((String) description);
+ return pigeonResult;
}
}
@@ -172,7 +281,7 @@
public interface CookieManagerHostApi {
void clearCookies(Result<Boolean> result);
- void setCookie(String url, String value);
+ void setCookie(@NonNull String url, @NonNull String value);
/** The codec used by CookieManagerHostApi. */
static MessageCodec<Object> getCodec() {
@@ -258,63 +367,76 @@
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
public interface WebViewHostApi {
- void create(Long instanceId, Boolean useHybridComposition);
+ void create(@NonNull Long instanceId, @NonNull Boolean useHybridComposition);
- void dispose(Long instanceId);
+ void dispose(@NonNull Long instanceId);
- void loadData(Long instanceId, String data, String mimeType, String encoding);
+ void loadData(
+ @NonNull Long instanceId,
+ @NonNull String data,
+ @Nullable String mimeType,
+ @Nullable String encoding);
void loadDataWithBaseUrl(
- Long instanceId,
- String baseUrl,
- String data,
- String mimeType,
- String encoding,
- String historyUrl);
+ @NonNull Long instanceId,
+ @Nullable String baseUrl,
+ @NonNull String data,
+ @Nullable String mimeType,
+ @Nullable String encoding,
+ @Nullable String historyUrl);
- void loadUrl(Long instanceId, String url, Map<String, String> headers);
+ void loadUrl(
+ @NonNull Long instanceId, @NonNull String url, @NonNull Map<String, String> headers);
- void postUrl(Long instanceId, String url, byte[] data);
+ void postUrl(@NonNull Long instanceId, @NonNull String url, @NonNull byte[] data);
- String getUrl(Long instanceId);
+ @Nullable
+ String getUrl(@NonNull Long instanceId);
- Boolean canGoBack(Long instanceId);
+ @NonNull
+ Boolean canGoBack(@NonNull Long instanceId);
- Boolean canGoForward(Long instanceId);
+ @NonNull
+ Boolean canGoForward(@NonNull Long instanceId);
- void goBack(Long instanceId);
+ void goBack(@NonNull Long instanceId);
- void goForward(Long instanceId);
+ void goForward(@NonNull Long instanceId);
- void reload(Long instanceId);
+ void reload(@NonNull Long instanceId);
- void clearCache(Long instanceId, Boolean includeDiskFiles);
+ void clearCache(@NonNull Long instanceId, @NonNull Boolean includeDiskFiles);
- void evaluateJavascript(Long instanceId, String javascriptString, Result<String> result);
+ void evaluateJavascript(
+ @NonNull Long instanceId, @NonNull String javascriptString, Result<String> result);
- String getTitle(Long instanceId);
+ @Nullable
+ String getTitle(@NonNull Long instanceId);
- void scrollTo(Long instanceId, Long x, Long y);
+ void scrollTo(@NonNull Long instanceId, @NonNull Long x, @NonNull Long y);
- void scrollBy(Long instanceId, Long x, Long y);
+ void scrollBy(@NonNull Long instanceId, @NonNull Long x, @NonNull Long y);
- Long getScrollX(Long instanceId);
+ @NonNull
+ Long getScrollX(@NonNull Long instanceId);
- Long getScrollY(Long instanceId);
+ @NonNull
+ Long getScrollY(@NonNull Long instanceId);
- void setWebContentsDebuggingEnabled(Boolean enabled);
+ void setWebContentsDebuggingEnabled(@NonNull Boolean enabled);
- void setWebViewClient(Long instanceId, Long webViewClientInstanceId);
+ void setWebViewClient(@NonNull Long instanceId, @NonNull Long webViewClientInstanceId);
- void addJavaScriptChannel(Long instanceId, Long javaScriptChannelInstanceId);
+ void addJavaScriptChannel(@NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId);
- void removeJavaScriptChannel(Long instanceId, Long javaScriptChannelInstanceId);
+ void removeJavaScriptChannel(
+ @NonNull Long instanceId, @NonNull Long javaScriptChannelInstanceId);
- void setDownloadListener(Long instanceId, Long listenerInstanceId);
+ void setDownloadListener(@NonNull Long instanceId, @Nullable Long listenerInstanceId);
- void setWebChromeClient(Long instanceId, Long clientInstanceId);
+ void setWebChromeClient(@NonNull Long instanceId, @Nullable Long clientInstanceId);
- void setBackgroundColor(Long instanceId, Long color);
+ void setBackgroundColor(@NonNull Long instanceId, @NonNull Long color);
/** The codec used by WebViewHostApi. */
static MessageCodec<Object> getCodec() {
@@ -341,7 +463,9 @@
if (useHybridCompositionArg == null) {
throw new NullPointerException("useHybridCompositionArg unexpectedly null.");
}
- api.create(instanceIdArg.longValue(), useHybridCompositionArg);
+ api.create(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(),
+ useHybridCompositionArg);
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -366,7 +490,7 @@
if (instanceIdArg == null) {
throw new NullPointerException("instanceIdArg unexpectedly null.");
}
- api.dispose(instanceIdArg.longValue());
+ api.dispose((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -396,14 +520,12 @@
throw new NullPointerException("dataArg unexpectedly null.");
}
String mimeTypeArg = (String) args.get(2);
- if (mimeTypeArg == null) {
- throw new NullPointerException("mimeTypeArg unexpectedly null.");
- }
String encodingArg = (String) args.get(3);
- if (encodingArg == null) {
- throw new NullPointerException("encodingArg unexpectedly null.");
- }
- api.loadData(instanceIdArg.longValue(), dataArg, mimeTypeArg, encodingArg);
+ api.loadData(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(),
+ dataArg,
+ mimeTypeArg,
+ encodingArg);
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -431,27 +553,15 @@
throw new NullPointerException("instanceIdArg unexpectedly null.");
}
String baseUrlArg = (String) args.get(1);
- if (baseUrlArg == null) {
- throw new NullPointerException("baseUrlArg unexpectedly null.");
- }
String dataArg = (String) args.get(2);
if (dataArg == null) {
throw new NullPointerException("dataArg unexpectedly null.");
}
String mimeTypeArg = (String) args.get(3);
- if (mimeTypeArg == null) {
- throw new NullPointerException("mimeTypeArg unexpectedly null.");
- }
String encodingArg = (String) args.get(4);
- if (encodingArg == null) {
- throw new NullPointerException("encodingArg unexpectedly null.");
- }
String historyUrlArg = (String) args.get(5);
- if (historyUrlArg == null) {
- throw new NullPointerException("historyUrlArg unexpectedly null.");
- }
api.loadDataWithBaseUrl(
- instanceIdArg.longValue(),
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(),
baseUrlArg,
dataArg,
mimeTypeArg,
@@ -489,7 +599,10 @@
if (headersArg == null) {
throw new NullPointerException("headersArg unexpectedly null.");
}
- api.loadUrl(instanceIdArg.longValue(), urlArg, headersArg);
+ api.loadUrl(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(),
+ urlArg,
+ headersArg);
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -522,7 +635,8 @@
if (dataArg == null) {
throw new NullPointerException("dataArg unexpectedly null.");
}
- api.postUrl(instanceIdArg.longValue(), urlArg, dataArg);
+ api.postUrl(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(), urlArg, dataArg);
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -547,7 +661,8 @@
if (instanceIdArg == null) {
throw new NullPointerException("instanceIdArg unexpectedly null.");
}
- String output = api.getUrl(instanceIdArg.longValue());
+ String output =
+ api.getUrl((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.put("result", output);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -572,7 +687,8 @@
if (instanceIdArg == null) {
throw new NullPointerException("instanceIdArg unexpectedly null.");
}
- Boolean output = api.canGoBack(instanceIdArg.longValue());
+ Boolean output =
+ api.canGoBack((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.put("result", output);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -597,7 +713,8 @@
if (instanceIdArg == null) {
throw new NullPointerException("instanceIdArg unexpectedly null.");
}
- Boolean output = api.canGoForward(instanceIdArg.longValue());
+ Boolean output =
+ api.canGoForward((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.put("result", output);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -622,7 +739,7 @@
if (instanceIdArg == null) {
throw new NullPointerException("instanceIdArg unexpectedly null.");
}
- api.goBack(instanceIdArg.longValue());
+ api.goBack((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -647,7 +764,7 @@
if (instanceIdArg == null) {
throw new NullPointerException("instanceIdArg unexpectedly null.");
}
- api.goForward(instanceIdArg.longValue());
+ api.goForward((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -672,7 +789,7 @@
if (instanceIdArg == null) {
throw new NullPointerException("instanceIdArg unexpectedly null.");
}
- api.reload(instanceIdArg.longValue());
+ api.reload((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -701,7 +818,9 @@
if (includeDiskFilesArg == null) {
throw new NullPointerException("includeDiskFilesArg unexpectedly null.");
}
- api.clearCache(instanceIdArg.longValue(), includeDiskFilesArg);
+ api.clearCache(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(),
+ includeDiskFilesArg);
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -746,7 +865,9 @@
};
api.evaluateJavascript(
- instanceIdArg.longValue(), javascriptStringArg, resultCallback);
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(),
+ javascriptStringArg,
+ resultCallback);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
reply.reply(wrapped);
@@ -770,7 +891,8 @@
if (instanceIdArg == null) {
throw new NullPointerException("instanceIdArg unexpectedly null.");
}
- String output = api.getTitle(instanceIdArg.longValue());
+ String output =
+ api.getTitle((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.put("result", output);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -803,7 +925,10 @@
if (yArg == null) {
throw new NullPointerException("yArg unexpectedly null.");
}
- api.scrollTo(instanceIdArg.longValue(), xArg.longValue(), yArg.longValue());
+ api.scrollTo(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(),
+ (xArg == null) ? null : xArg.longValue(),
+ (yArg == null) ? null : yArg.longValue());
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -836,7 +961,10 @@
if (yArg == null) {
throw new NullPointerException("yArg unexpectedly null.");
}
- api.scrollBy(instanceIdArg.longValue(), xArg.longValue(), yArg.longValue());
+ api.scrollBy(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(),
+ (xArg == null) ? null : xArg.longValue(),
+ (yArg == null) ? null : yArg.longValue());
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -861,7 +989,8 @@
if (instanceIdArg == null) {
throw new NullPointerException("instanceIdArg unexpectedly null.");
}
- Long output = api.getScrollX(instanceIdArg.longValue());
+ Long output =
+ api.getScrollX((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.put("result", output);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -886,7 +1015,8 @@
if (instanceIdArg == null) {
throw new NullPointerException("instanceIdArg unexpectedly null.");
}
- Long output = api.getScrollY(instanceIdArg.longValue());
+ Long output =
+ api.getScrollY((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.put("result", output);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -943,7 +1073,10 @@
throw new NullPointerException("webViewClientInstanceIdArg unexpectedly null.");
}
api.setWebViewClient(
- instanceIdArg.longValue(), webViewClientInstanceIdArg.longValue());
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(),
+ (webViewClientInstanceIdArg == null)
+ ? null
+ : webViewClientInstanceIdArg.longValue());
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -976,7 +1109,10 @@
"javaScriptChannelInstanceIdArg unexpectedly null.");
}
api.addJavaScriptChannel(
- instanceIdArg.longValue(), javaScriptChannelInstanceIdArg.longValue());
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(),
+ (javaScriptChannelInstanceIdArg == null)
+ ? null
+ : javaScriptChannelInstanceIdArg.longValue());
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -1009,7 +1145,10 @@
"javaScriptChannelInstanceIdArg unexpectedly null.");
}
api.removeJavaScriptChannel(
- instanceIdArg.longValue(), javaScriptChannelInstanceIdArg.longValue());
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(),
+ (javaScriptChannelInstanceIdArg == null)
+ ? null
+ : javaScriptChannelInstanceIdArg.longValue());
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -1037,11 +1176,9 @@
throw new NullPointerException("instanceIdArg unexpectedly null.");
}
Number listenerInstanceIdArg = (Number) args.get(1);
- if (listenerInstanceIdArg == null) {
- throw new NullPointerException("listenerInstanceIdArg unexpectedly null.");
- }
api.setDownloadListener(
- instanceIdArg.longValue(), listenerInstanceIdArg.longValue());
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(),
+ (listenerInstanceIdArg == null) ? null : listenerInstanceIdArg.longValue());
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -1069,11 +1206,9 @@
throw new NullPointerException("instanceIdArg unexpectedly null.");
}
Number clientInstanceIdArg = (Number) args.get(1);
- if (clientInstanceIdArg == null) {
- throw new NullPointerException("clientInstanceIdArg unexpectedly null.");
- }
api.setWebChromeClient(
- instanceIdArg.longValue(), clientInstanceIdArg.longValue());
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(),
+ (clientInstanceIdArg == null) ? null : clientInstanceIdArg.longValue());
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -1104,7 +1239,9 @@
if (colorArg == null) {
throw new NullPointerException("colorArg unexpectedly null.");
}
- api.setBackgroundColor(instanceIdArg.longValue(), colorArg.longValue());
+ api.setBackgroundColor(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(),
+ (colorArg == null) ? null : colorArg.longValue());
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -1126,33 +1263,33 @@
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
public interface WebSettingsHostApi {
- void create(Long instanceId, Long webViewInstanceId);
+ void create(@NonNull Long instanceId, @NonNull Long webViewInstanceId);
- void dispose(Long instanceId);
+ void dispose(@NonNull Long instanceId);
- void setDomStorageEnabled(Long instanceId, Boolean flag);
+ void setDomStorageEnabled(@NonNull Long instanceId, @NonNull Boolean flag);
- void setJavaScriptCanOpenWindowsAutomatically(Long instanceId, Boolean flag);
+ void setJavaScriptCanOpenWindowsAutomatically(@NonNull Long instanceId, @NonNull Boolean flag);
- void setSupportMultipleWindows(Long instanceId, Boolean support);
+ void setSupportMultipleWindows(@NonNull Long instanceId, @NonNull Boolean support);
- void setJavaScriptEnabled(Long instanceId, Boolean flag);
+ void setJavaScriptEnabled(@NonNull Long instanceId, @NonNull Boolean flag);
- void setUserAgentString(Long instanceId, String userAgentString);
+ void setUserAgentString(@NonNull Long instanceId, @Nullable String userAgentString);
- void setMediaPlaybackRequiresUserGesture(Long instanceId, Boolean require);
+ void setMediaPlaybackRequiresUserGesture(@NonNull Long instanceId, @NonNull Boolean require);
- void setSupportZoom(Long instanceId, Boolean support);
+ void setSupportZoom(@NonNull Long instanceId, @NonNull Boolean support);
- void setLoadWithOverviewMode(Long instanceId, Boolean overview);
+ void setLoadWithOverviewMode(@NonNull Long instanceId, @NonNull Boolean overview);
- void setUseWideViewPort(Long instanceId, Boolean use);
+ void setUseWideViewPort(@NonNull Long instanceId, @NonNull Boolean use);
- void setDisplayZoomControls(Long instanceId, Boolean enabled);
+ void setDisplayZoomControls(@NonNull Long instanceId, @NonNull Boolean enabled);
- void setBuiltInZoomControls(Long instanceId, Boolean enabled);
+ void setBuiltInZoomControls(@NonNull Long instanceId, @NonNull Boolean enabled);
- void setAllowFileAccess(Long instanceId, Boolean enabled);
+ void setAllowFileAccess(@NonNull Long instanceId, @NonNull Boolean enabled);
/** The codec used by WebSettingsHostApi. */
static MessageCodec<Object> getCodec() {
@@ -1181,7 +1318,9 @@
if (webViewInstanceIdArg == null) {
throw new NullPointerException("webViewInstanceIdArg unexpectedly null.");
}
- api.create(instanceIdArg.longValue(), webViewInstanceIdArg.longValue());
+ api.create(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(),
+ (webViewInstanceIdArg == null) ? null : webViewInstanceIdArg.longValue());
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -1206,7 +1345,7 @@
if (instanceIdArg == null) {
throw new NullPointerException("instanceIdArg unexpectedly null.");
}
- api.dispose(instanceIdArg.longValue());
+ api.dispose((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -1237,7 +1376,8 @@
if (flagArg == null) {
throw new NullPointerException("flagArg unexpectedly null.");
}
- api.setDomStorageEnabled(instanceIdArg.longValue(), flagArg);
+ api.setDomStorageEnabled(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg);
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -1268,7 +1408,8 @@
if (flagArg == null) {
throw new NullPointerException("flagArg unexpectedly null.");
}
- api.setJavaScriptCanOpenWindowsAutomatically(instanceIdArg.longValue(), flagArg);
+ api.setJavaScriptCanOpenWindowsAutomatically(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg);
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -1299,7 +1440,8 @@
if (supportArg == null) {
throw new NullPointerException("supportArg unexpectedly null.");
}
- api.setSupportMultipleWindows(instanceIdArg.longValue(), supportArg);
+ api.setSupportMultipleWindows(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg);
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -1330,7 +1472,8 @@
if (flagArg == null) {
throw new NullPointerException("flagArg unexpectedly null.");
}
- api.setJavaScriptEnabled(instanceIdArg.longValue(), flagArg);
+ api.setJavaScriptEnabled(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(), flagArg);
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -1358,10 +1501,9 @@
throw new NullPointerException("instanceIdArg unexpectedly null.");
}
String userAgentStringArg = (String) args.get(1);
- if (userAgentStringArg == null) {
- throw new NullPointerException("userAgentStringArg unexpectedly null.");
- }
- api.setUserAgentString(instanceIdArg.longValue(), userAgentStringArg);
+ api.setUserAgentString(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(),
+ userAgentStringArg);
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -1392,7 +1534,8 @@
if (requireArg == null) {
throw new NullPointerException("requireArg unexpectedly null.");
}
- api.setMediaPlaybackRequiresUserGesture(instanceIdArg.longValue(), requireArg);
+ api.setMediaPlaybackRequiresUserGesture(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(), requireArg);
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -1423,7 +1566,8 @@
if (supportArg == null) {
throw new NullPointerException("supportArg unexpectedly null.");
}
- api.setSupportZoom(instanceIdArg.longValue(), supportArg);
+ api.setSupportZoom(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(), supportArg);
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -1454,7 +1598,8 @@
if (overviewArg == null) {
throw new NullPointerException("overviewArg unexpectedly null.");
}
- api.setLoadWithOverviewMode(instanceIdArg.longValue(), overviewArg);
+ api.setLoadWithOverviewMode(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(), overviewArg);
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -1485,7 +1630,8 @@
if (useArg == null) {
throw new NullPointerException("useArg unexpectedly null.");
}
- api.setUseWideViewPort(instanceIdArg.longValue(), useArg);
+ api.setUseWideViewPort(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(), useArg);
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -1516,7 +1662,8 @@
if (enabledArg == null) {
throw new NullPointerException("enabledArg unexpectedly null.");
}
- api.setDisplayZoomControls(instanceIdArg.longValue(), enabledArg);
+ api.setDisplayZoomControls(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg);
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -1547,7 +1694,8 @@
if (enabledArg == null) {
throw new NullPointerException("enabledArg unexpectedly null.");
}
- api.setBuiltInZoomControls(instanceIdArg.longValue(), enabledArg);
+ api.setBuiltInZoomControls(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg);
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -1578,7 +1726,8 @@
if (enabledArg == null) {
throw new NullPointerException("enabledArg unexpectedly null.");
}
- api.setAllowFileAccess(instanceIdArg.longValue(), enabledArg);
+ api.setAllowFileAccess(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(), enabledArg);
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -1601,7 +1750,7 @@
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
public interface JavaScriptChannelHostApi {
- void create(Long instanceId, String channelName);
+ void create(@NonNull Long instanceId, @NonNull String channelName);
/** The codec used by JavaScriptChannelHostApi. */
static MessageCodec<Object> getCodec() {
@@ -1631,7 +1780,8 @@
if (channelNameArg == null) {
throw new NullPointerException("channelNameArg unexpectedly null.");
}
- api.create(instanceIdArg.longValue(), channelNameArg);
+ api.create(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(), channelNameArg);
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -1668,7 +1818,7 @@
return JavaScriptChannelFlutterApiCodec.INSTANCE;
}
- public void dispose(Long instanceIdArg, Reply<Void> callback) {
+ public void dispose(@NonNull Long instanceIdArg, Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger,
@@ -1681,7 +1831,8 @@
});
}
- public void postMessage(Long instanceIdArg, String messageArg, Reply<Void> callback) {
+ public void postMessage(
+ @NonNull Long instanceIdArg, @NonNull String messageArg, Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger,
@@ -1703,7 +1854,7 @@
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
public interface WebViewClientHostApi {
- void create(Long instanceId, Boolean shouldOverrideUrlLoading);
+ void create(@NonNull Long instanceId, @NonNull Boolean shouldOverrideUrlLoading);
/** The codec used by WebViewClientHostApi. */
static MessageCodec<Object> getCodec() {
@@ -1734,7 +1885,9 @@
throw new NullPointerException(
"shouldOverrideUrlLoadingArg unexpectedly null.");
}
- api.create(instanceIdArg.longValue(), shouldOverrideUrlLoadingArg);
+ api.create(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(),
+ shouldOverrideUrlLoadingArg);
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -1797,7 +1950,7 @@
return WebViewClientFlutterApiCodec.INSTANCE;
}
- public void dispose(Long instanceIdArg, Reply<Void> callback) {
+ public void dispose(@NonNull Long instanceIdArg, Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.dispose", getCodec());
@@ -1809,7 +1962,10 @@
}
public void onPageStarted(
- Long instanceIdArg, Long webViewInstanceIdArg, String urlArg, Reply<Void> callback) {
+ @NonNull Long instanceIdArg,
+ @NonNull Long webViewInstanceIdArg,
+ @NonNull String urlArg,
+ Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger,
@@ -1823,7 +1979,10 @@
}
public void onPageFinished(
- Long instanceIdArg, Long webViewInstanceIdArg, String urlArg, Reply<Void> callback) {
+ @NonNull Long instanceIdArg,
+ @NonNull Long webViewInstanceIdArg,
+ @NonNull String urlArg,
+ Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger,
@@ -1837,10 +1996,10 @@
}
public void onReceivedRequestError(
- Long instanceIdArg,
- Long webViewInstanceIdArg,
- WebResourceRequestData requestArg,
- WebResourceErrorData errorArg,
+ @NonNull Long instanceIdArg,
+ @NonNull Long webViewInstanceIdArg,
+ @NonNull WebResourceRequestData requestArg,
+ @NonNull WebResourceErrorData errorArg,
Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
@@ -1856,11 +2015,11 @@
}
public void onReceivedError(
- Long instanceIdArg,
- Long webViewInstanceIdArg,
- Long errorCodeArg,
- String descriptionArg,
- String failingUrlArg,
+ @NonNull Long instanceIdArg,
+ @NonNull Long webViewInstanceIdArg,
+ @NonNull Long errorCodeArg,
+ @NonNull String descriptionArg,
+ @NonNull String failingUrlArg,
Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
@@ -1881,9 +2040,9 @@
}
public void requestLoading(
- Long instanceIdArg,
- Long webViewInstanceIdArg,
- WebResourceRequestData requestArg,
+ @NonNull Long instanceIdArg,
+ @NonNull Long webViewInstanceIdArg,
+ @NonNull WebResourceRequestData requestArg,
Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
@@ -1898,7 +2057,10 @@
}
public void urlLoading(
- Long instanceIdArg, Long webViewInstanceIdArg, String urlArg, Reply<Void> callback) {
+ @NonNull Long instanceIdArg,
+ @NonNull Long webViewInstanceIdArg,
+ @NonNull String urlArg,
+ Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger, "dev.flutter.pigeon.WebViewClientFlutterApi.urlLoading", getCodec());
@@ -1918,7 +2080,7 @@
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
public interface DownloadListenerHostApi {
- void create(Long instanceId);
+ void create(@NonNull Long instanceId);
/** The codec used by DownloadListenerHostApi. */
static MessageCodec<Object> getCodec() {
@@ -1944,7 +2106,7 @@
if (instanceIdArg == null) {
throw new NullPointerException("instanceIdArg unexpectedly null.");
}
- api.create(instanceIdArg.longValue());
+ api.create((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -1981,7 +2143,7 @@
return DownloadListenerFlutterApiCodec.INSTANCE;
}
- public void dispose(Long instanceIdArg, Reply<Void> callback) {
+ public void dispose(@NonNull Long instanceIdArg, Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger, "dev.flutter.pigeon.DownloadListenerFlutterApi.dispose", getCodec());
@@ -1993,12 +2155,12 @@
}
public void onDownloadStart(
- Long instanceIdArg,
- String urlArg,
- String userAgentArg,
- String contentDispositionArg,
- String mimetypeArg,
- Long contentLengthArg,
+ @NonNull Long instanceIdArg,
+ @NonNull String urlArg,
+ @NonNull String userAgentArg,
+ @NonNull String contentDispositionArg,
+ @NonNull String mimetypeArg,
+ @NonNull Long contentLengthArg,
Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
@@ -2028,7 +2190,7 @@
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
public interface WebChromeClientHostApi {
- void create(Long instanceId, Long webViewClientInstanceId);
+ void create(@NonNull Long instanceId, @NonNull Long webViewClientInstanceId);
/** The codec used by WebChromeClientHostApi. */
static MessageCodec<Object> getCodec() {
@@ -2058,7 +2220,11 @@
if (webViewClientInstanceIdArg == null) {
throw new NullPointerException("webViewClientInstanceIdArg unexpectedly null.");
}
- api.create(instanceIdArg.longValue(), webViewClientInstanceIdArg.longValue());
+ api.create(
+ (instanceIdArg == null) ? null : instanceIdArg.longValue(),
+ (webViewClientInstanceIdArg == null)
+ ? null
+ : webViewClientInstanceIdArg.longValue());
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -2081,9 +2247,11 @@
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
public interface FlutterAssetManagerHostApi {
- List<String> list(String path);
+ @NonNull
+ List<String> list(@NonNull String path);
- String getAssetFilePathByName(String name);
+ @NonNull
+ String getAssetFilePathByName(@NonNull String name);
/** The codec used by FlutterAssetManagerHostApi. */
static MessageCodec<Object> getCodec() {
@@ -2173,7 +2341,7 @@
return WebChromeClientFlutterApiCodec.INSTANCE;
}
- public void dispose(Long instanceIdArg, Reply<Void> callback) {
+ public void dispose(@NonNull Long instanceIdArg, Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger, "dev.flutter.pigeon.WebChromeClientFlutterApi.dispose", getCodec());
@@ -2185,7 +2353,10 @@
}
public void onProgressChanged(
- Long instanceIdArg, Long webViewInstanceIdArg, Long progressArg, Reply<Void> callback) {
+ @NonNull Long instanceIdArg,
+ @NonNull Long webViewInstanceIdArg,
+ @NonNull Long progressArg,
+ Reply<Void> callback) {
BasicMessageChannel<Object> channel =
new BasicMessageChannel<>(
binaryMessenger,
@@ -2207,9 +2378,9 @@
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */
public interface WebStorageHostApi {
- void create(Long instanceId);
+ void create(@NonNull Long instanceId);
- void deleteAllData(Long instanceId);
+ void deleteAllData(@NonNull Long instanceId);
/** The codec used by WebStorageHostApi. */
static MessageCodec<Object> getCodec() {
@@ -2234,7 +2405,7 @@
if (instanceIdArg == null) {
throw new NullPointerException("instanceIdArg unexpectedly null.");
}
- api.create(instanceIdArg.longValue());
+ api.create((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -2259,7 +2430,7 @@
if (instanceIdArg == null) {
throw new NullPointerException("instanceIdArg unexpectedly null.");
}
- api.deleteAllData(instanceIdArg.longValue());
+ api.deleteAllData((instanceIdArg == null) ? null : instanceIdArg.longValue());
wrapped.put("result", null);
} catch (Error | RuntimeException exception) {
wrapped.put("error", wrapError(exception));
@@ -2277,7 +2448,9 @@
Map<String, Object> errorMap = new HashMap<>();
errorMap.put("message", exception.toString());
errorMap.put("code", exception.getClass().getSimpleName());
- errorMap.put("details", null);
+ errorMap.put(
+ "details",
+ "Cause: " + exception.getCause() + ", Stacktrace: " + Log.getStackTraceString(exception));
return errorMap;
}
}
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 9e462fa..b488568 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
@@ -14,6 +14,7 @@
import androidx.webkit.WebResourceErrorCompat;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugins.webviewflutter.GeneratedAndroidWebView.WebViewClientFlutterApi;
+import java.util.HashMap;
/**
* Flutter Api implementation for {@link WebViewClient}.
@@ -26,40 +27,39 @@
@RequiresApi(api = Build.VERSION_CODES.M)
static GeneratedAndroidWebView.WebResourceErrorData createWebResourceErrorData(
WebResourceError error) {
- final GeneratedAndroidWebView.WebResourceErrorData errorData =
- new GeneratedAndroidWebView.WebResourceErrorData();
- errorData.setErrorCode((long) error.getErrorCode());
- errorData.setDescription(error.getDescription().toString());
-
- return errorData;
+ return new GeneratedAndroidWebView.WebResourceErrorData.Builder()
+ .setErrorCode((long) error.getErrorCode())
+ .setDescription(error.getDescription().toString())
+ .build();
}
@SuppressLint("RequiresFeature")
static GeneratedAndroidWebView.WebResourceErrorData createWebResourceErrorData(
WebResourceErrorCompat error) {
- final GeneratedAndroidWebView.WebResourceErrorData errorData =
- new GeneratedAndroidWebView.WebResourceErrorData();
- errorData.setErrorCode((long) error.getErrorCode());
- errorData.setDescription(error.getDescription().toString());
-
- return errorData;
+ return new GeneratedAndroidWebView.WebResourceErrorData.Builder()
+ .setErrorCode((long) error.getErrorCode())
+ .setDescription(error.getDescription().toString())
+ .build();
}
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
static GeneratedAndroidWebView.WebResourceRequestData createWebResourceRequestData(
WebResourceRequest request) {
- final GeneratedAndroidWebView.WebResourceRequestData requestData =
- new GeneratedAndroidWebView.WebResourceRequestData();
- requestData.setUrl(request.getUrl().toString());
- requestData.setIsForMainFrame(request.isForMainFrame());
+ final GeneratedAndroidWebView.WebResourceRequestData.Builder requestData =
+ new GeneratedAndroidWebView.WebResourceRequestData.Builder()
+ .setUrl(request.getUrl().toString())
+ .setIsForMainFrame(request.isForMainFrame())
+ .setHasGesture(request.hasGesture())
+ .setMethod(request.getMethod())
+ .setRequestHeaders(
+ request.getRequestHeaders() != null
+ ? request.getRequestHeaders()
+ : new HashMap<>());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
requestData.setIsRedirect(request.isRedirect());
}
- requestData.setHasGesture(request.hasGesture());
- requestData.setMethod(request.getMethod());
- requestData.setRequestHeaders(request.getRequestHeaders());
- return requestData;
+ return requestData.build();
}
/**
diff --git a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewHostApiImpl.java b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewHostApiImpl.java
index 0f31613..afc3efe 100644
--- a/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewHostApiImpl.java
+++ b/packages/webview_flutter/webview_flutter_android/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewHostApiImpl.java
@@ -28,11 +28,6 @@
* <p>Handles creating {@link WebView}s that intercommunicate with a paired Dart object.
*/
public class WebViewHostApiImpl implements WebViewHostApi {
- // TODO(bparrishMines): This can be removed once pigeon supports null values: https://github.com/flutter/flutter/issues/59118
- // Workaround to represent null Strings since pigeon doesn't support null
- // values.
- private static final String nullStringIdentifier = "<null-value>";
-
private final InstanceManager instanceManager;
private final WebViewProxy webViewProxy;
// Only used with WebView using virtual displays.
@@ -355,8 +350,7 @@
@Override
public void loadData(Long instanceId, String data, String mimeType, String encoding) {
final WebView webView = (WebView) instanceManager.getInstance(instanceId);
- webView.loadData(
- data, parseNullStringIdentifier(mimeType), parseNullStringIdentifier(encoding));
+ webView.loadData(data, mimeType, encoding);
}
@Override
@@ -368,12 +362,7 @@
String encoding,
String historyUrl) {
final WebView webView = (WebView) instanceManager.getInstance(instanceId);
- webView.loadDataWithBaseURL(
- parseNullStringIdentifier(baseUrl),
- data,
- parseNullStringIdentifier(mimeType),
- parseNullStringIdentifier(encoding),
- parseNullStringIdentifier(historyUrl));
+ webView.loadDataWithBaseURL(baseUrl, data, mimeType, encoding, historyUrl);
}
@Override
@@ -391,8 +380,7 @@
@Override
public String getUrl(Long instanceId) {
final WebView webView = (WebView) instanceManager.getInstance(instanceId);
- final String result = webView.getUrl();
- return result != null ? result : nullStringIdentifier;
+ return webView.getUrl();
}
@Override
@@ -441,8 +429,7 @@
@Override
public String getTitle(Long instanceId) {
final WebView webView = (WebView) instanceManager.getInstance(instanceId);
- final String result = webView.getTitle();
- return result != null ? result : nullStringIdentifier;
+ return webView.getTitle();
}
@Override
@@ -513,13 +500,4 @@
final WebView webView = (WebView) instanceManager.getInstance(instanceId);
webView.setBackgroundColor(color.intValue());
}
-
- @Nullable
- private static String parseNullStringIdentifier(String value) {
- if (value.equals(nullStringIdentifier)) {
- return null;
- }
-
- return value;
- }
}
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 62d2723..c2abd25 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
@@ -4,16 +4,22 @@
package io.flutter.plugins.webviewflutter;
+import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import android.net.Uri;
+import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import io.flutter.plugins.webviewflutter.WebViewClientHostApiImpl.WebViewClientCompatImpl;
import io.flutter.plugins.webviewflutter.WebViewClientHostApiImpl.WebViewClientCreator;
+import java.util.HashMap;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -96,4 +102,20 @@
webViewClient.shouldOverrideUrlLoading(mockWebView, "");
verify(mockFlutterApi, never()).urlLoading((WebViewClient) any(), any(), any(), any());
}
+
+ @Test
+ public void convertWebResourceRequestWithNullHeaders() {
+ final Uri mockUri = mock(Uri.class);
+ when(mockUri.toString()).thenReturn("");
+
+ final WebResourceRequest mockRequest = mock(WebResourceRequest.class);
+ when(mockRequest.getMethod()).thenReturn("method");
+ when(mockRequest.getUrl()).thenReturn(mockUri);
+ when(mockRequest.isForMainFrame()).thenReturn(true);
+ when(mockRequest.getRequestHeaders()).thenReturn(null);
+
+ final GeneratedAndroidWebView.WebResourceRequestData data =
+ WebViewClientFlutterApiImpl.createWebResourceRequestData(mockRequest);
+ assertEquals(data.getRequestHeaders(), new HashMap<String, String>());
+ }
}
diff --git a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewTest.java b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewTest.java
index 2312b76..5be39ab 100644
--- a/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewTest.java
+++ b/packages/webview_flutter/webview_flutter_android/android/src/test/java/io/flutter/plugins/webviewflutter/WebViewTest.java
@@ -166,8 +166,7 @@
@Test
public void loadDataWithNullValues() {
- testHostApiImpl.loadData(
- 0L, "VGhpcyBkYXRhIGlzIGJhc2U2NCBlbmNvZGVkLg==", "<null-value>", "<null-value>");
+ testHostApiImpl.loadData(0L, "VGhpcyBkYXRhIGlzIGJhc2U2NCBlbmNvZGVkLg==", null, null);
verify(mockWebView).loadData("VGhpcyBkYXRhIGlzIGJhc2U2NCBlbmNvZGVkLg==", null, null);
}
@@ -192,12 +191,7 @@
@Test
public void loadDataWithBaseUrlAndNullValues() {
testHostApiImpl.loadDataWithBaseUrl(
- 0L,
- "<null-value>",
- "VGhpcyBkYXRhIGlzIGJhc2U2NCBlbmNvZGVkLg==",
- "<null-value>",
- "<null-value>",
- "<null-value>");
+ 0L, null, "VGhpcyBkYXRhIGlzIGJhc2U2NCBlbmNvZGVkLg==", null, null, null);
verify(mockWebView)
.loadDataWithBaseURL(null, "VGhpcyBkYXRhIGlzIGJhc2U2NCBlbmNvZGVkLg==", null, null, null);
}
diff --git a/packages/webview_flutter/webview_flutter_android/generatePigeons.sh b/packages/webview_flutter/webview_flutter_android/generatePigeons.sh
deleted file mode 100755
index 30a6918..0000000
--- a/packages/webview_flutter/webview_flutter_android/generatePigeons.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-# Copyright 2013 The Flutter Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-flutter pub run pigeon \
---input pigeons/android_webview.dart \
---dart_out lib/src/android_webview.pigeon.dart \
---dart_test_out test/android_webview.pigeon.dart \
---java_out android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.Java \
---java_package io.flutter.plugins.webviewflutter
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 bd50640..f858fb3 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
@@ -11,11 +11,6 @@
import 'android_webview.pigeon.dart';
import 'android_webview_api_impls.dart';
-// TODO(bparrishMines): This can be removed once pigeon supports null values: https://github.com/flutter/flutter/issues/59118
-// Workaround to represent null Strings since pigeon doesn't support null
-// values.
-const String _nullStringIdentifier = '<null-value>';
-
/// An Android View that displays web pages.
///
/// **Basic usage**
@@ -102,8 +97,8 @@
return api.loadDataFromInstance(
this,
data,
- mimeType ?? _nullStringIdentifier,
- encoding ?? _nullStringIdentifier,
+ mimeType,
+ encoding,
);
}
@@ -151,11 +146,11 @@
}) {
return api.loadDataWithBaseUrlFromInstance(
this,
- baseUrl ?? _nullStringIdentifier,
+ baseUrl,
data,
- mimeType ?? _nullStringIdentifier,
- encoding ?? _nullStringIdentifier,
- historyUrl ?? _nullStringIdentifier,
+ mimeType,
+ encoding,
+ historyUrl,
);
}
@@ -184,12 +179,8 @@
/// begun, the current page may not have changed.
///
/// Returns null if no page has been loaded.
- Future<String?> getUrl() async {
- final String result = await api.getUrlFromInstance(this);
- if (result == _nullStringIdentifier) {
- return null;
- }
- return result;
+ Future<String?> getUrl() {
+ return api.getUrlFromInstance(this);
}
/// Whether this WebView has a back history item.
@@ -235,27 +226,19 @@
/// JavaScript state from an empty WebView is no longer persisted across
/// navigations like [loadUrl]. For example, global variables and functions
/// defined before calling [loadUrl]) will not exist in the loaded page.
- Future<String?> evaluateJavascript(String javascriptString) async {
- final String result = await api.evaluateJavascriptFromInstance(
+ Future<String?> evaluateJavascript(String javascriptString) {
+ return api.evaluateJavascriptFromInstance(
this,
javascriptString,
);
- if (result == _nullStringIdentifier) {
- return null;
- }
- return result;
}
// TODO(bparrishMines): Update documentation when WebViewClient.onReceivedTitle is added.
/// Gets the title for the current page.
///
/// Returns null if no page has been loaded.
- Future<String?> getTitle() async {
- final String result = await api.getTitleFromInstance(this);
- if (result == _nullStringIdentifier) {
- return null;
- }
- return result;
+ Future<String?> getTitle() {
+ return api.getTitleFromInstance(this);
}
// TODO(bparrishMines): Update documentation when onScrollChanged is added.
@@ -337,9 +320,11 @@
/// Registers the interface to be used when content can not be handled by the rendering engine, and should be downloaded instead.
///
/// This will replace the current handler.
- Future<void> setDownloadListener(DownloadListener listener) {
- DownloadListener.api.createFromInstance(listener);
- return api.setDownloadListenerFromInstance(this, listener);
+ Future<void> setDownloadListener(DownloadListener? listener) async {
+ await Future.wait(<Future<void>>[
+ if (listener != null) DownloadListener.api.createFromInstance(listener),
+ api.setDownloadListenerFromInstance(this, listener)
+ ]);
}
/// Sets the chrome handler.
@@ -347,7 +332,7 @@
/// This is an implementation of [WebChromeClient] for use in handling
/// JavaScript dialogs, favicons, titles, and the progress. This will replace
/// the current handler.
- Future<void> setWebChromeClient(WebChromeClient client) {
+ Future<void> setWebChromeClient(WebChromeClient? client) async {
// WebView requires a WebViewClient because of a bug fix that makes
// calls to WebViewClient.requestLoading/WebViewClient.urlLoading when a new
// window is opened. This is to make sure a url opened by `Window.open` has
@@ -356,8 +341,11 @@
_currentWebViewClient != null,
"Can't set a WebChromeClient without setting a WebViewClient first.",
);
- WebChromeClient.api.createFromInstance(client, _currentWebViewClient!);
- return api.setWebChromeClientFromInstance(this, client);
+ await Future.wait(<Future<void>>[
+ if (client != null)
+ WebChromeClient.api.createFromInstance(client, _currentWebViewClient!),
+ api.setWebChromeClientFromInstance(this, client),
+ ]);
}
/// Sets the background color of this WebView.
@@ -477,7 +465,7 @@
/// If the string is empty, the system default value will be used. Note that
/// starting from KITKAT Android version, changing the user-agent while
/// loading a web page causes WebView to initiate loading once again.
- Future<void> setUserAgentString(String userAgentString) {
+ Future<void> setUserAgentString(String? userAgentString) {
return api.setUserAgentStringFromInstance(this, userAgentString);
}
diff --git a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.pigeon.dart b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.pigeon.dart
index 4a0965e..4491e16 100644
--- a/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.pigeon.dart
+++ b/packages/webview_flutter/webview_flutter_android/lib/src/android_webview.pigeon.dart
@@ -1,8 +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 (v1.0.9), do not edit directly.
+// Autogenerated from Pigeon (v3.0.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
// @dart = 2.12
@@ -13,12 +12,21 @@
import 'package:flutter/services.dart';
class WebResourceRequestData {
- String? url;
- bool? isForMainFrame;
+ WebResourceRequestData({
+ required this.url,
+ required this.isForMainFrame,
+ this.isRedirect,
+ required this.hasGesture,
+ required this.method,
+ required this.requestHeaders,
+ });
+
+ String url;
+ bool isForMainFrame;
bool? isRedirect;
- bool? hasGesture;
- String? method;
- Map<String?, String?>? requestHeaders;
+ bool hasGesture;
+ String method;
+ Map<String?, String?> requestHeaders;
Object encode() {
final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
@@ -33,20 +41,26 @@
static WebResourceRequestData decode(Object message) {
final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
- return WebResourceRequestData()
- ..url = pigeonMap['url'] as String?
- ..isForMainFrame = pigeonMap['isForMainFrame'] as bool?
- ..isRedirect = pigeonMap['isRedirect'] as bool?
- ..hasGesture = pigeonMap['hasGesture'] as bool?
- ..method = pigeonMap['method'] as String?
- ..requestHeaders = (pigeonMap['requestHeaders'] as Map<Object?, Object?>?)
- ?.cast<String?, String?>();
+ return WebResourceRequestData(
+ url: pigeonMap['url']! as String,
+ isForMainFrame: pigeonMap['isForMainFrame']! as bool,
+ isRedirect: pigeonMap['isRedirect'] as bool?,
+ hasGesture: pigeonMap['hasGesture']! as bool,
+ method: pigeonMap['method']! as String,
+ requestHeaders: (pigeonMap['requestHeaders'] as Map<Object?, Object?>?)!
+ .cast<String?, String?>(),
+ );
}
}
class WebResourceErrorData {
- int? errorCode;
- String? description;
+ WebResourceErrorData({
+ required this.errorCode,
+ required this.description,
+ });
+
+ int errorCode;
+ String description;
Object encode() {
final Map<Object?, Object?> pigeonMap = <Object?, Object?>{};
@@ -57,9 +71,10 @@
static WebResourceErrorData decode(Object message) {
final Map<Object?, Object?> pigeonMap = message as Map<Object?, Object?>;
- return WebResourceErrorData()
- ..errorCode = pigeonMap['errorCode'] as int?
- ..description = pigeonMap['description'] as String?;
+ return WebResourceErrorData(
+ errorCode: pigeonMap['errorCode']! as int,
+ description: pigeonMap['description']! as String,
+ );
}
}
@@ -88,7 +103,6 @@
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -98,6 +112,11 @@
message: error['message'] as String?,
details: error['details'],
);
+ } else if (replyMap['result'] == null) {
+ throw PlatformException(
+ code: 'null-error',
+ message: 'Host platform returned null value for non-null return value.',
+ );
} else {
return (replyMap['result'] as bool?)!;
}
@@ -108,12 +127,11 @@
'dev.flutter.pigeon.CookieManagerHostApi.setCookie', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap = await channel
- .send(<Object>[arg_url, arg_value]) as Map<Object?, Object?>?;
+ .send(<Object?>[arg_url, arg_value]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -149,13 +167,12 @@
'dev.flutter.pigeon.WebViewHostApi.create', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_instanceId, arg_useHybridComposition])
+ await channel.send(<Object?>[arg_instanceId, arg_useHybridComposition])
as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -175,12 +192,11 @@
'dev.flutter.pigeon.WebViewHostApi.dispose', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_instanceId]) as Map<Object?, Object?>?;
+ await channel.send(<Object?>[arg_instanceId]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -196,18 +212,17 @@
}
Future<void> loadData(int arg_instanceId, String arg_data,
- String arg_mimeType, String arg_encoding) async {
+ String? arg_mimeType, String? arg_encoding) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.WebViewHostApi.loadData', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap = await channel.send(
- <Object>[arg_instanceId, arg_data, arg_mimeType, arg_encoding])
+ <Object?>[arg_instanceId, arg_data, arg_mimeType, arg_encoding])
as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -224,15 +239,15 @@
Future<void> loadDataWithBaseUrl(
int arg_instanceId,
- String arg_baseUrl,
+ String? arg_baseUrl,
String arg_data,
- String arg_mimeType,
- String arg_encoding,
- String arg_historyUrl) async {
+ String? arg_mimeType,
+ String? arg_encoding,
+ String? arg_historyUrl) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl', codec,
binaryMessenger: _binaryMessenger);
- final Map<Object?, Object?>? replyMap = await channel.send(<Object>[
+ final Map<Object?, Object?>? replyMap = await channel.send(<Object?>[
arg_instanceId,
arg_baseUrl,
arg_data,
@@ -244,7 +259,6 @@
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -265,13 +279,12 @@
'dev.flutter.pigeon.WebViewHostApi.loadUrl', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_instanceId, arg_url, arg_headers])
+ await channel.send(<Object?>[arg_instanceId, arg_url, arg_headers])
as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -292,13 +305,12 @@
'dev.flutter.pigeon.WebViewHostApi.postUrl', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_instanceId, arg_url, arg_data])
+ await channel.send(<Object?>[arg_instanceId, arg_url, arg_data])
as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -313,17 +325,16 @@
}
}
- Future<String> getUrl(int arg_instanceId) async {
+ Future<String?> getUrl(int arg_instanceId) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.WebViewHostApi.getUrl', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_instanceId]) as Map<Object?, Object?>?;
+ await channel.send(<Object?>[arg_instanceId]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -334,7 +345,7 @@
details: error['details'],
);
} else {
- return (replyMap['result'] as String?)!;
+ return (replyMap['result'] as String?);
}
}
@@ -343,12 +354,11 @@
'dev.flutter.pigeon.WebViewHostApi.canGoBack', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_instanceId]) as Map<Object?, Object?>?;
+ await channel.send(<Object?>[arg_instanceId]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -358,6 +368,11 @@
message: error['message'] as String?,
details: error['details'],
);
+ } else if (replyMap['result'] == null) {
+ throw PlatformException(
+ code: 'null-error',
+ message: 'Host platform returned null value for non-null return value.',
+ );
} else {
return (replyMap['result'] as bool?)!;
}
@@ -368,12 +383,11 @@
'dev.flutter.pigeon.WebViewHostApi.canGoForward', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_instanceId]) as Map<Object?, Object?>?;
+ await channel.send(<Object?>[arg_instanceId]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -383,6 +397,11 @@
message: error['message'] as String?,
details: error['details'],
);
+ } else if (replyMap['result'] == null) {
+ throw PlatformException(
+ code: 'null-error',
+ message: 'Host platform returned null value for non-null return value.',
+ );
} else {
return (replyMap['result'] as bool?)!;
}
@@ -393,12 +412,11 @@
'dev.flutter.pigeon.WebViewHostApi.goBack', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_instanceId]) as Map<Object?, Object?>?;
+ await channel.send(<Object?>[arg_instanceId]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -418,12 +436,11 @@
'dev.flutter.pigeon.WebViewHostApi.goForward', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_instanceId]) as Map<Object?, Object?>?;
+ await channel.send(<Object?>[arg_instanceId]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -443,12 +460,11 @@
'dev.flutter.pigeon.WebViewHostApi.reload', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_instanceId]) as Map<Object?, Object?>?;
+ await channel.send(<Object?>[arg_instanceId]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -468,13 +484,12 @@
'dev.flutter.pigeon.WebViewHostApi.clearCache', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_instanceId, arg_includeDiskFiles])
+ await channel.send(<Object?>[arg_instanceId, arg_includeDiskFiles])
as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -489,19 +504,18 @@
}
}
- Future<String> evaluateJavascript(
+ Future<String?> evaluateJavascript(
int arg_instanceId, String arg_javascriptString) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.WebViewHostApi.evaluateJavascript', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_instanceId, arg_javascriptString])
+ await channel.send(<Object?>[arg_instanceId, arg_javascriptString])
as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -512,21 +526,20 @@
details: error['details'],
);
} else {
- return (replyMap['result'] as String?)!;
+ return (replyMap['result'] as String?);
}
}
- Future<String> getTitle(int arg_instanceId) async {
+ Future<String?> getTitle(int arg_instanceId) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.WebViewHostApi.getTitle', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_instanceId]) as Map<Object?, Object?>?;
+ await channel.send(<Object?>[arg_instanceId]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -537,7 +550,7 @@
details: error['details'],
);
} else {
- return (replyMap['result'] as String?)!;
+ return (replyMap['result'] as String?);
}
}
@@ -545,13 +558,13 @@
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.WebViewHostApi.scrollTo', codec,
binaryMessenger: _binaryMessenger);
- final Map<Object?, Object?>? replyMap = await channel
- .send(<Object>[arg_instanceId, arg_x, arg_y]) as Map<Object?, Object?>?;
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(<Object?>[arg_instanceId, arg_x, arg_y])
+ as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -570,13 +583,13 @@
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.WebViewHostApi.scrollBy', codec,
binaryMessenger: _binaryMessenger);
- final Map<Object?, Object?>? replyMap = await channel
- .send(<Object>[arg_instanceId, arg_x, arg_y]) as Map<Object?, Object?>?;
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(<Object?>[arg_instanceId, arg_x, arg_y])
+ as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -596,12 +609,11 @@
'dev.flutter.pigeon.WebViewHostApi.getScrollX', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_instanceId]) as Map<Object?, Object?>?;
+ await channel.send(<Object?>[arg_instanceId]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -611,6 +623,11 @@
message: error['message'] as String?,
details: error['details'],
);
+ } else if (replyMap['result'] == null) {
+ throw PlatformException(
+ code: 'null-error',
+ message: 'Host platform returned null value for non-null return value.',
+ );
} else {
return (replyMap['result'] as int?)!;
}
@@ -621,12 +638,11 @@
'dev.flutter.pigeon.WebViewHostApi.getScrollY', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_instanceId]) as Map<Object?, Object?>?;
+ await channel.send(<Object?>[arg_instanceId]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -636,6 +652,11 @@
message: error['message'] as String?,
details: error['details'],
);
+ } else if (replyMap['result'] == null) {
+ throw PlatformException(
+ code: 'null-error',
+ message: 'Host platform returned null value for non-null return value.',
+ );
} else {
return (replyMap['result'] as int?)!;
}
@@ -647,12 +668,11 @@
codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_enabled]) as Map<Object?, Object?>?;
+ await channel.send(<Object?>[arg_enabled]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -673,13 +693,12 @@
'dev.flutter.pigeon.WebViewHostApi.setWebViewClient', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap = await channel
- .send(<Object>[arg_instanceId, arg_webViewClientInstanceId])
+ .send(<Object?>[arg_instanceId, arg_webViewClientInstanceId])
as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -700,13 +719,12 @@
'dev.flutter.pigeon.WebViewHostApi.addJavaScriptChannel', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap = await channel
- .send(<Object>[arg_instanceId, arg_javaScriptChannelInstanceId])
+ .send(<Object?>[arg_instanceId, arg_javaScriptChannelInstanceId])
as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -727,13 +745,12 @@
'dev.flutter.pigeon.WebViewHostApi.removeJavaScriptChannel', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap = await channel
- .send(<Object>[arg_instanceId, arg_javaScriptChannelInstanceId])
+ .send(<Object?>[arg_instanceId, arg_javaScriptChannelInstanceId])
as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -749,18 +766,17 @@
}
Future<void> setDownloadListener(
- int arg_instanceId, int arg_listenerInstanceId) async {
+ int arg_instanceId, int? arg_listenerInstanceId) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.WebViewHostApi.setDownloadListener', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_instanceId, arg_listenerInstanceId])
+ await channel.send(<Object?>[arg_instanceId, arg_listenerInstanceId])
as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -776,18 +792,17 @@
}
Future<void> setWebChromeClient(
- int arg_instanceId, int arg_clientInstanceId) async {
+ int arg_instanceId, int? arg_clientInstanceId) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.WebViewHostApi.setWebChromeClient', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_instanceId, arg_clientInstanceId])
+ await channel.send(<Object?>[arg_instanceId, arg_clientInstanceId])
as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -807,12 +822,11 @@
'dev.flutter.pigeon.WebViewHostApi.setBackgroundColor', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap = await channel
- .send(<Object>[arg_instanceId, arg_color]) as Map<Object?, Object?>?;
+ .send(<Object?>[arg_instanceId, arg_color]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -848,13 +862,12 @@
'dev.flutter.pigeon.WebSettingsHostApi.create', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_instanceId, arg_webViewInstanceId])
+ await channel.send(<Object?>[arg_instanceId, arg_webViewInstanceId])
as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -874,12 +887,11 @@
'dev.flutter.pigeon.WebSettingsHostApi.dispose', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_instanceId]) as Map<Object?, Object?>?;
+ await channel.send(<Object?>[arg_instanceId]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -899,12 +911,11 @@
'dev.flutter.pigeon.WebSettingsHostApi.setDomStorageEnabled', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap = await channel
- .send(<Object>[arg_instanceId, arg_flag]) as Map<Object?, Object?>?;
+ .send(<Object?>[arg_instanceId, arg_flag]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -926,12 +937,11 @@
codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap = await channel
- .send(<Object>[arg_instanceId, arg_flag]) as Map<Object?, Object?>?;
+ .send(<Object?>[arg_instanceId, arg_flag]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -953,12 +963,11 @@
codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap = await channel
- .send(<Object>[arg_instanceId, arg_support]) as Map<Object?, Object?>?;
+ .send(<Object?>[arg_instanceId, arg_support]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -978,12 +987,11 @@
'dev.flutter.pigeon.WebSettingsHostApi.setJavaScriptEnabled', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap = await channel
- .send(<Object>[arg_instanceId, arg_flag]) as Map<Object?, Object?>?;
+ .send(<Object?>[arg_instanceId, arg_flag]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -999,18 +1007,17 @@
}
Future<void> setUserAgentString(
- int arg_instanceId, String arg_userAgentString) async {
+ int arg_instanceId, String? arg_userAgentString) async {
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_instanceId, arg_userAgentString])
+ await channel.send(<Object?>[arg_instanceId, arg_userAgentString])
as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -1032,12 +1039,11 @@
codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap = await channel
- .send(<Object>[arg_instanceId, arg_require]) as Map<Object?, Object?>?;
+ .send(<Object?>[arg_instanceId, arg_require]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -1057,12 +1063,11 @@
'dev.flutter.pigeon.WebSettingsHostApi.setSupportZoom', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap = await channel
- .send(<Object>[arg_instanceId, arg_support]) as Map<Object?, Object?>?;
+ .send(<Object?>[arg_instanceId, arg_support]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -1082,13 +1087,13 @@
final BasicMessageChannel<Object?> channel = BasicMessageChannel<Object?>(
'dev.flutter.pigeon.WebSettingsHostApi.setLoadWithOverviewMode', codec,
binaryMessenger: _binaryMessenger);
- final Map<Object?, Object?>? replyMap = await channel
- .send(<Object>[arg_instanceId, arg_overview]) as Map<Object?, Object?>?;
+ final Map<Object?, Object?>? replyMap =
+ await channel.send(<Object?>[arg_instanceId, arg_overview])
+ as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -1108,12 +1113,11 @@
'dev.flutter.pigeon.WebSettingsHostApi.setUseWideViewPort', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap = await channel
- .send(<Object>[arg_instanceId, arg_use]) as Map<Object?, Object?>?;
+ .send(<Object?>[arg_instanceId, arg_use]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -1134,12 +1138,11 @@
'dev.flutter.pigeon.WebSettingsHostApi.setDisplayZoomControls', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap = await channel
- .send(<Object>[arg_instanceId, arg_enabled]) as Map<Object?, Object?>?;
+ .send(<Object?>[arg_instanceId, arg_enabled]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -1160,12 +1163,11 @@
'dev.flutter.pigeon.WebSettingsHostApi.setBuiltInZoomControls', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap = await channel
- .send(<Object>[arg_instanceId, arg_enabled]) as Map<Object?, Object?>?;
+ .send(<Object?>[arg_instanceId, arg_enabled]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -1185,12 +1187,11 @@
'dev.flutter.pigeon.WebSettingsHostApi.setAllowFileAccess', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap = await channel
- .send(<Object>[arg_instanceId, arg_enabled]) as Map<Object?, Object?>?;
+ .send(<Object?>[arg_instanceId, arg_enabled]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -1226,13 +1227,12 @@
'dev.flutter.pigeon.JavaScriptChannelHostApi.create', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_instanceId, arg_channelName])
+ await channel.send(<Object?>[arg_instanceId, arg_channelName])
as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -1325,13 +1325,12 @@
'dev.flutter.pigeon.WebViewClientHostApi.create', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap = await channel
- .send(<Object>[arg_instanceId, arg_shouldOverrideUrlLoading])
+ .send(<Object?>[arg_instanceId, arg_shouldOverrideUrlLoading])
as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -1600,12 +1599,11 @@
'dev.flutter.pigeon.DownloadListenerHostApi.create', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_instanceId]) as Map<Object?, Object?>?;
+ await channel.send(<Object?>[arg_instanceId]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -1712,13 +1710,12 @@
'dev.flutter.pigeon.WebChromeClientHostApi.create', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap = await channel
- .send(<Object>[arg_instanceId, arg_webViewClientInstanceId])
+ .send(<Object?>[arg_instanceId, arg_webViewClientInstanceId])
as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -1754,12 +1751,11 @@
'dev.flutter.pigeon.FlutterAssetManagerHostApi.list', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_path]) as Map<Object?, Object?>?;
+ await channel.send(<Object?>[arg_path]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -1769,6 +1765,11 @@
message: error['message'] as String?,
details: error['details'],
);
+ } else if (replyMap['result'] == null) {
+ throw PlatformException(
+ code: 'null-error',
+ message: 'Host platform returned null value for non-null return value.',
+ );
} else {
return (replyMap['result'] as List<Object?>?)!.cast<String?>();
}
@@ -1780,12 +1781,11 @@
codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_name]) as Map<Object?, Object?>?;
+ await channel.send(<Object?>[arg_name]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -1795,6 +1795,11 @@
message: error['message'] as String?,
details: error['details'],
);
+ } else if (replyMap['result'] == null) {
+ throw PlatformException(
+ code: 'null-error',
+ message: 'Host platform returned null value for non-null return value.',
+ );
} else {
return (replyMap['result'] as String?)!;
}
@@ -1881,12 +1886,11 @@
'dev.flutter.pigeon.WebStorageHostApi.create', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_instanceId]) as Map<Object?, Object?>?;
+ await channel.send(<Object?>[arg_instanceId]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
@@ -1906,12 +1910,11 @@
'dev.flutter.pigeon.WebStorageHostApi.deleteAllData', codec,
binaryMessenger: _binaryMessenger);
final Map<Object?, Object?>? replyMap =
- await channel.send(<Object>[arg_instanceId]) as Map<Object?, Object?>?;
+ await channel.send(<Object?>[arg_instanceId]) as Map<Object?, Object?>?;
if (replyMap == null) {
throw PlatformException(
code: 'channel-error',
message: 'Unable to establish connection on channel.',
- details: null,
);
} else if (replyMap['error'] != null) {
final Map<Object?, Object?> error =
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 9c980c8..b40a051 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
@@ -13,21 +13,20 @@
/// Converts [WebResourceRequestData] to [WebResourceRequest]
WebResourceRequest _toWebResourceRequest(WebResourceRequestData data) {
return WebResourceRequest(
- url: data.url!,
- isForMainFrame: data.isForMainFrame!,
+ url: data.url,
+ isForMainFrame: data.isForMainFrame,
isRedirect: data.isRedirect,
- hasGesture: data.hasGesture!,
- method: data.method!,
- requestHeaders:
- data.requestHeaders?.cast<String, String>() ?? <String, String>{},
+ hasGesture: data.hasGesture,
+ method: data.method,
+ requestHeaders: data.requestHeaders.cast<String, String>(),
);
}
/// Converts [WebResourceErrorData] to [WebResourceError].
WebResourceError _toWebResourceError(WebResourceErrorData data) {
return WebResourceError(
- errorCode: data.errorCode!,
- description: data.description!,
+ errorCode: data.errorCode,
+ description: data.description,
);
}
@@ -115,8 +114,8 @@
Future<void> loadDataFromInstance(
WebView instance,
String data,
- String mimeType,
- String encoding,
+ String? mimeType,
+ String? encoding,
) {
return loadData(
instanceManager.getInstanceId(instance)!,
@@ -129,11 +128,11 @@
/// Helper method to convert instances ids to objects.
Future<void> loadDataWithBaseUrlFromInstance(
WebView instance,
- String baseUrl,
+ String? baseUrl,
String data,
- String mimeType,
- String encoding,
- String historyUrl,
+ String? mimeType,
+ String? encoding,
+ String? historyUrl,
) {
return loadDataWithBaseUrl(
instanceManager.getInstanceId(instance)!,
@@ -164,7 +163,7 @@
}
/// Helper method to convert instances ids to objects.
- Future<String> getUrlFromInstance(WebView instance) {
+ Future<String?> getUrlFromInstance(WebView instance) {
return getUrl(instanceManager.getInstanceId(instance)!);
}
@@ -202,16 +201,18 @@
}
/// Helper method to convert instances ids to objects.
- Future<String> evaluateJavascriptFromInstance(
+ Future<String?> evaluateJavascriptFromInstance(
WebView instance,
String javascriptString,
) {
return evaluateJavascript(
- instanceManager.getInstanceId(instance)!, javascriptString);
+ instanceManager.getInstanceId(instance)!,
+ javascriptString,
+ );
}
/// Helper method to convert instances ids to objects.
- Future<String> getTitleFromInstance(WebView instance) {
+ Future<String?> getTitleFromInstance(WebView instance) {
return getTitle(instanceManager.getInstanceId(instance)!);
}
@@ -271,22 +272,22 @@
/// Helper method to convert instances ids to objects.
Future<void> setDownloadListenerFromInstance(
WebView instance,
- DownloadListener listener,
+ DownloadListener? listener,
) {
return setDownloadListener(
instanceManager.getInstanceId(instance)!,
- instanceManager.getInstanceId(listener)!,
+ listener != null ? instanceManager.getInstanceId(listener) : null,
);
}
/// Helper method to convert instances ids to objects.
Future<void> setWebChromeClientFromInstance(
WebView instance,
- WebChromeClient client,
+ WebChromeClient? client,
) {
return setWebChromeClient(
instanceManager.getInstanceId(instance)!,
- instanceManager.getInstanceId(client)!,
+ client != null ? instanceManager.getInstanceId(client) : null,
);
}
@@ -370,7 +371,7 @@
/// Helper method to convert instances ids to objects.
Future<void> setUserAgentStringFromInstance(
WebSettings instance,
- String userAgentString,
+ String? userAgentString,
) {
return setUserAgentString(
instanceManager.getInstanceId(instance)!,
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 d3d18f6..70ecd99 100644
--- a/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart
+++ b/packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart
@@ -4,18 +4,51 @@
import 'package:pigeon/pigeon.dart';
+@ConfigurePigeon(
+ PigeonOptions(
+ dartOut: 'lib/src/android_webview.pigeon.dart',
+ dartTestOut: 'test/test_android_webview.pigeon.dart',
+ dartOptions: DartOptions(copyrightHeader: <String>[
+ '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.',
+ ]),
+ javaOut:
+ 'android/src/main/java/io/flutter/plugins/webviewflutter/GeneratedAndroidWebView.java',
+ javaOptions: JavaOptions(
+ package: 'io.flutter.plugins.webviewflutter',
+ className: 'GeneratedAndroidWebView',
+ copyrightHeader: <String>[
+ '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.',
+ ],
+ ),
+ ),
+)
class WebResourceRequestData {
- String? url;
- bool? isForMainFrame;
+ WebResourceRequestData(
+ this.url,
+ this.isForMainFrame,
+ this.isRedirect,
+ this.hasGesture,
+ this.method,
+ this.requestHeaders,
+ );
+
+ String url;
+ bool isForMainFrame;
bool? isRedirect;
- bool? hasGesture;
- String? method;
- Map<String?, String?>? requestHeaders;
+ bool hasGesture;
+ String method;
+ Map<String?, String?> requestHeaders;
}
class WebResourceErrorData {
- int? errorCode;
- String? description;
+ WebResourceErrorData(this.errorCode, this.description);
+
+ int errorCode;
+ String description;
}
@HostApi()
@@ -35,17 +68,17 @@
void loadData(
int instanceId,
String data,
- String mimeType,
- String encoding,
+ String? mimeType,
+ String? encoding,
);
void loadDataWithBaseUrl(
int instanceId,
- String baseUrl,
+ String? baseUrl,
String data,
- String mimeType,
- String encoding,
- String historyUrl,
+ String? mimeType,
+ String? encoding,
+ String? historyUrl,
);
void loadUrl(
@@ -60,7 +93,7 @@
Uint8List data,
);
- String getUrl(int instanceId);
+ String? getUrl(int instanceId);
bool canGoBack(int instanceId);
@@ -75,12 +108,12 @@
void clearCache(int instanceId, bool includeDiskFiles);
@async
- String evaluateJavascript(
+ String? evaluateJavascript(
int instanceId,
String javascriptString,
);
- String getTitle(int instanceId);
+ String? getTitle(int instanceId);
void scrollTo(int instanceId, int x, int y);
@@ -98,9 +131,9 @@
void removeJavaScriptChannel(int instanceId, int javaScriptChannelInstanceId);
- void setDownloadListener(int instanceId, int listenerInstanceId);
+ void setDownloadListener(int instanceId, int? listenerInstanceId);
- void setWebChromeClient(int instanceId, int clientInstanceId);
+ void setWebChromeClient(int instanceId, int? clientInstanceId);
void setBackgroundColor(int instanceId, int color);
}
@@ -119,7 +152,7 @@
void setJavaScriptEnabled(int instanceId, bool flag);
- void setUserAgentString(int instanceId, String userAgentString);
+ void setUserAgentString(int instanceId, String? userAgentString);
void setMediaPlaybackRequiresUserGesture(int instanceId, bool require);
diff --git a/packages/webview_flutter/webview_flutter_android/pubspec.yaml b/packages/webview_flutter/webview_flutter_android/pubspec.yaml
index 3fae698..9a7c48a 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/plugins/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: 2.8.5
+version: 2.8.6
environment:
sdk: ">=2.14.0 <3.0.0"
@@ -29,4 +29,4 @@
sdk: flutter
mockito: ^5.1.0
pedantic: ^1.10.0
- pigeon: 1.0.9
+ pigeon: ^3.0.3
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 e2e6513..4c63ab0 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
@@ -10,8 +10,8 @@
import 'package:webview_flutter_android/src/android_webview_api_impls.dart';
import 'package:webview_flutter_android/src/instance_manager.dart';
-import 'android_webview.pigeon.dart';
import 'android_webview_test.mocks.dart';
+import 'test_android_webview.pigeon.dart';
@GenerateMocks(<Type>[
CookieManagerHostApi,
@@ -85,8 +85,8 @@
verify(mockPlatformHostApi.loadData(
webViewInstanceId,
'hello',
- '<null-value>',
- '<null-value>',
+ null,
+ null,
));
});
@@ -113,11 +113,11 @@
webView.loadDataWithBaseUrl(data: 'hello');
verify(mockPlatformHostApi.loadDataWithBaseUrl(
webViewInstanceId,
- '<null-value>',
+ null,
'hello',
- '<null-value>',
- '<null-value>',
- '<null-value>',
+ null,
+ null,
+ null,
));
});
@@ -527,14 +527,15 @@
flutterApi.onReceivedRequestError(
mockWebViewClientInstanceId,
mockWebViewInstanceId,
- WebResourceRequestData()
- ..url = 'https://www.google.com'
- ..isForMainFrame = true
- ..hasGesture = true
- ..method = 'POST',
- WebResourceErrorData()
- ..errorCode = 34
- ..description = 'error description',
+ WebResourceRequestData(
+ url: 'https://www.google.com',
+ isForMainFrame: true,
+ hasGesture: true,
+ method: 'POST',
+ isRedirect: false,
+ requestHeaders: <String?, String?>{},
+ ),
+ WebResourceErrorData(errorCode: 34, description: 'error description'),
);
verify(mockWebViewClient.onReceivedRequestError(
@@ -565,11 +566,14 @@
flutterApi.requestLoading(
mockWebViewClientInstanceId,
mockWebViewInstanceId,
- WebResourceRequestData()
- ..url = 'https://www.google.com'
- ..isForMainFrame = true
- ..hasGesture = true
- ..method = 'POST',
+ WebResourceRequestData(
+ url: 'https://www.google.com',
+ isForMainFrame: true,
+ hasGesture: true,
+ method: 'POST',
+ isRedirect: true,
+ requestHeaders: <String?, String?>{},
+ ),
);
verify(mockWebViewClient.requestLoading(
diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview_test.mocks.dart b/packages/webview_flutter/webview_flutter_android/test/android_webview_test.mocks.dart
index e8859c9..85ab668 100644
--- a/packages/webview_flutter/webview_flutter_android/test/android_webview_test.mocks.dart
+++ b/packages/webview_flutter/webview_flutter_android/test/android_webview_test.mocks.dart
@@ -10,7 +10,7 @@
import 'package:webview_flutter_android/src/android_webview.dart' as _i2;
import 'package:webview_flutter_android/src/android_webview.pigeon.dart' as _i3;
-import 'android_webview.pigeon.dart' as _i5;
+import 'test_android_webview.pigeon.dart' as _i5;
// ignore_for_file: type=lint
// ignore_for_file: avoid_redundant_argument_values
@@ -277,9 +277,8 @@
super.noSuchMethod(Invocation.method(#postUrl, [instanceId, url, data]),
returnValueForMissingStub: null);
@override
- String getUrl(int? instanceId) =>
- (super.noSuchMethod(Invocation.method(#getUrl, [instanceId]),
- returnValue: '') as String);
+ String? getUrl(int? instanceId) =>
+ (super.noSuchMethod(Invocation.method(#getUrl, [instanceId])) as String?);
@override
bool canGoBack(int? instanceId) =>
(super.noSuchMethod(Invocation.method(#canGoBack, [instanceId]),
@@ -306,16 +305,16 @@
Invocation.method(#clearCache, [instanceId, includeDiskFiles]),
returnValueForMissingStub: null);
@override
- _i4.Future<String> evaluateJavascript(
+ _i4.Future<String?> evaluateJavascript(
int? instanceId, String? javascriptString) =>
(super.noSuchMethod(
Invocation.method(
#evaluateJavascript, [instanceId, javascriptString]),
- returnValue: Future<String>.value('')) as _i4.Future<String>);
+ returnValue: Future<String?>.value()) as _i4.Future<String?>);
@override
- String getTitle(int? instanceId) =>
- (super.noSuchMethod(Invocation.method(#getTitle, [instanceId]),
- returnValue: '') as String);
+ String? getTitle(int? instanceId) =>
+ (super.noSuchMethod(Invocation.method(#getTitle, [instanceId]))
+ as String?);
@override
void scrollTo(int? instanceId, int? x, int? y) =>
super.noSuchMethod(Invocation.method(#scrollTo, [instanceId, x, y]),
diff --git a/packages/webview_flutter/webview_flutter_android/test/android_webview.pigeon.dart b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.pigeon.dart
similarity index 95%
rename from packages/webview_flutter/webview_flutter_android/test/android_webview.pigeon.dart
rename to packages/webview_flutter/webview_flutter_android/test/test_android_webview.pigeon.dart
index 4ee4b1d..e3c5909 100644
--- a/packages/webview_flutter/webview_flutter_android/test/android_webview.pigeon.dart
+++ b/packages/webview_flutter/webview_flutter_android/test/test_android_webview.pigeon.dart
@@ -1,10 +1,10 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
-// Autogenerated from Pigeon (v1.0.9), do not edit directly.
+// Autogenerated from Pigeon (v3.0.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
+// ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import, unnecessary_parenthesis
+// ignore_for_file: avoid_relative_lib_imports
// @dart = 2.12
import 'dart:async';
import 'dart:typed_data' show Uint8List, Int32List, Int64List, Float64List;
@@ -23,20 +23,21 @@
void create(int instanceId, bool useHybridComposition);
void dispose(int instanceId);
- void loadData(int instanceId, String data, String mimeType, String encoding);
- void loadDataWithBaseUrl(int instanceId, String baseUrl, String data,
- String mimeType, String encoding, String historyUrl);
+ void loadData(
+ int instanceId, String data, String? mimeType, String? encoding);
+ void loadDataWithBaseUrl(int instanceId, String? baseUrl, String data,
+ String? mimeType, String? encoding, String? historyUrl);
void loadUrl(int instanceId, String url, Map<String?, String?> headers);
void postUrl(int instanceId, String url, Uint8List data);
- String getUrl(int instanceId);
+ String? getUrl(int instanceId);
bool canGoBack(int instanceId);
bool canGoForward(int instanceId);
void goBack(int instanceId);
void goForward(int instanceId);
void reload(int instanceId);
void clearCache(int instanceId, bool includeDiskFiles);
- Future<String> evaluateJavascript(int instanceId, String javascriptString);
- String getTitle(int instanceId);
+ Future<String?> evaluateJavascript(int instanceId, String javascriptString);
+ String? getTitle(int instanceId);
void scrollTo(int instanceId, int x, int y);
void scrollBy(int instanceId, int x, int y);
int getScrollX(int instanceId);
@@ -45,8 +46,8 @@
void setWebViewClient(int instanceId, int webViewClientInstanceId);
void addJavaScriptChannel(int instanceId, int javaScriptChannelInstanceId);
void removeJavaScriptChannel(int instanceId, int javaScriptChannelInstanceId);
- void setDownloadListener(int instanceId, int listenerInstanceId);
- void setWebChromeClient(int instanceId, int clientInstanceId);
+ void setDownloadListener(int instanceId, int? listenerInstanceId);
+ void setWebChromeClient(int instanceId, int? clientInstanceId);
void setBackgroundColor(int instanceId, int color);
static void setup(TestWebViewHostApi? api,
{BinaryMessenger? binaryMessenger}) {
@@ -109,13 +110,8 @@
assert(arg_data != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null, expected non-null String.');
final String? arg_mimeType = (args[2] as String?);
- assert(arg_mimeType != null,
- 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null, expected non-null String.');
final String? arg_encoding = (args[3] as String?);
- assert(arg_encoding != null,
- 'Argument for dev.flutter.pigeon.WebViewHostApi.loadData was null, expected non-null String.');
- api.loadData(
- arg_instanceId!, arg_data!, arg_mimeType!, arg_encoding!);
+ api.loadData(arg_instanceId!, arg_data!, arg_mimeType, arg_encoding);
return <Object?, Object?>{};
});
}
@@ -135,22 +131,14 @@
assert(arg_instanceId != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null, expected non-null int.');
final String? arg_baseUrl = (args[1] as String?);
- assert(arg_baseUrl != null,
- 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null, expected non-null String.');
final String? arg_data = (args[2] as String?);
assert(arg_data != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null, expected non-null String.');
final String? arg_mimeType = (args[3] as String?);
- assert(arg_mimeType != null,
- 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null, expected non-null String.');
final String? arg_encoding = (args[4] as String?);
- assert(arg_encoding != null,
- 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null, expected non-null String.');
final String? arg_historyUrl = (args[5] as String?);
- assert(arg_historyUrl != null,
- 'Argument for dev.flutter.pigeon.WebViewHostApi.loadDataWithBaseUrl was null, expected non-null String.');
- api.loadDataWithBaseUrl(arg_instanceId!, arg_baseUrl!, arg_data!,
- arg_mimeType!, arg_encoding!, arg_historyUrl!);
+ api.loadDataWithBaseUrl(arg_instanceId!, arg_baseUrl, arg_data!,
+ arg_mimeType, arg_encoding, arg_historyUrl);
return <Object?, Object?>{};
});
}
@@ -220,7 +208,7 @@
final int? arg_instanceId = (args[0] as int?);
assert(arg_instanceId != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.getUrl was null, expected non-null int.');
- final String output = api.getUrl(arg_instanceId!);
+ final String? output = api.getUrl(arg_instanceId!);
return <Object?, Object?>{'result': output};
});
}
@@ -359,7 +347,7 @@
final String? arg_javascriptString = (args[1] as String?);
assert(arg_javascriptString != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.evaluateJavascript was null, expected non-null String.');
- final String output = await api.evaluateJavascript(
+ final String? output = await api.evaluateJavascript(
arg_instanceId!, arg_javascriptString!);
return <Object?, Object?>{'result': output};
});
@@ -379,7 +367,7 @@
final int? arg_instanceId = (args[0] as int?);
assert(arg_instanceId != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.getTitle was null, expected non-null int.');
- final String output = api.getTitle(arg_instanceId!);
+ final String? output = api.getTitle(arg_instanceId!);
return <Object?, Object?>{'result': output};
});
}
@@ -575,9 +563,7 @@
assert(arg_instanceId != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null, expected non-null int.');
final int? arg_listenerInstanceId = (args[1] as int?);
- assert(arg_listenerInstanceId != null,
- 'Argument for dev.flutter.pigeon.WebViewHostApi.setDownloadListener was null, expected non-null int.');
- api.setDownloadListener(arg_instanceId!, arg_listenerInstanceId!);
+ api.setDownloadListener(arg_instanceId!, arg_listenerInstanceId);
return <Object?, Object?>{};
});
}
@@ -597,9 +583,7 @@
assert(arg_instanceId != null,
'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null, expected non-null int.');
final int? arg_clientInstanceId = (args[1] as int?);
- assert(arg_clientInstanceId != null,
- 'Argument for dev.flutter.pigeon.WebViewHostApi.setWebChromeClient was null, expected non-null int.');
- api.setWebChromeClient(arg_instanceId!, arg_clientInstanceId!);
+ api.setWebChromeClient(arg_instanceId!, arg_clientInstanceId);
return <Object?, Object?>{};
});
}
@@ -642,7 +626,7 @@
void setJavaScriptCanOpenWindowsAutomatically(int instanceId, bool flag);
void setSupportMultipleWindows(int instanceId, bool support);
void setJavaScriptEnabled(int instanceId, bool flag);
- void setUserAgentString(int instanceId, String userAgentString);
+ void setUserAgentString(int instanceId, String? userAgentString);
void setMediaPlaybackRequiresUserGesture(int instanceId, bool require);
void setSupportZoom(int instanceId, bool support);
void setLoadWithOverviewMode(int instanceId, bool overview);
@@ -799,9 +783,7 @@
assert(arg_instanceId != null,
'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null, expected non-null int.');
final String? arg_userAgentString = (args[1] as String?);
- assert(arg_userAgentString != null,
- 'Argument for dev.flutter.pigeon.WebSettingsHostApi.setUserAgentString was null, expected non-null String.');
- api.setUserAgentString(arg_instanceId!, arg_userAgentString!);
+ api.setUserAgentString(arg_instanceId!, arg_userAgentString);
return <Object?, Object?>{};
});
}
diff --git a/packages/webview_flutter/webview_flutter_android/test/webview_android_widget_test.dart b/packages/webview_flutter/webview_flutter_android/test/webview_android_widget_test.dart
index 46d6a29..83662fb 100644
--- a/packages/webview_flutter/webview_flutter_android/test/webview_android_widget_test.dart
+++ b/packages/webview_flutter/webview_flutter_android/test/webview_android_widget_test.dart
@@ -16,8 +16,8 @@
import 'package:webview_flutter_android/webview_android_widget.dart';
import 'package:webview_flutter_platform_interface/webview_flutter_platform_interface.dart';
-import 'android_webview.pigeon.dart';
import 'android_webview_test.mocks.dart' show MockTestWebViewHostApi;
+import 'test_android_webview.pigeon.dart';
import 'webview_android_widget_test.mocks.dart';
@GenerateMocks(<Type>[