-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[webview_flutter_android] Updates pigeon
version to support null safety
#5395
Conversation
pigeon
version to support null safety
.setRequestHeaders( | ||
request.getRequestHeaders() != null | ||
? request.getRequestHeaders() | ||
: new HashMap<>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently request.getRequestHeaders()
can return null
04-27 07:50:01.128: D/AndroidRuntime(21722): Shutting down VM
04-27 07:50:01.128: D/AndroidRuntime(21722): --------- beginning of crash
04-27 07:50:01.128: E/AndroidRuntime(21722): FATAL EXCEPTION: main
04-27 07:50:01.128: E/AndroidRuntime(21722): Process: io.flutter.plugins.webviewflutterandroidexample, PID: 21722
04-27 07:50:01.128: E/AndroidRuntime(21722): java.lang.IllegalStateException: Nonnull field "requestHeaders" is null.
04-27 07:50:01.128: E/AndroidRuntime(21722): at io.flutter.plugins.webviewflutter.GeneratedAndroidWebView$WebResourceRequestData.setRequestHeaders(GeneratedAndroidWebView.java:103)
04-27 07:50:01.128: E/AndroidRuntime(21722): at io.flutter.plugins.webviewflutter.GeneratedAndroidWebView$WebResourceRequestData$Builder.build(GeneratedAndroidWebView.java:161)
04-27 07:50:01.128: E/AndroidRuntime(21722): at io.flutter.plugins.webviewflutter.WebViewClientFlutterApiImpl.createWebResourceRequestData(WebViewClientFlutterApiImpl.java:58)
04-27 07:50:01.128: E/AndroidRuntime(21722): at io.flutter.plugins.webviewflutter.WebViewClientFlutterApiImpl.requestLoading(WebViewClientFlutterApiImpl.java:164)
04-27 07:50:01.128: E/AndroidRuntime(21722): at io.flutter.plugins.webviewflutter.WebViewClientHostApiImpl$WebViewClientImpl.shouldOverrideUrlLoading(WebViewClientHostApiImpl.java:88)
04-27 07:50:01.128: E/AndroidRuntime(21722): at org.chromium.android_webview.AwContentsClientBridge.shouldOverrideUrlLoading(chromium-TrichromeWebViewGoogle.apk-stable-410410683:16)
04-27 07:50:01.128: E/AndroidRuntime(21722): at android.os.MessageQueue.nativePollOnce(Native Method)
04-27 07:50:01.128: E/AndroidRuntime(21722): at android.os.MessageQueue.next(MessageQueue.java:335)
04-27 07:50:01.128: E/AndroidRuntime(21722): at android.os.Looper.loop(Looper.java:183)
04-27 07:50:01.128: E/AndroidRuntime(21722): at android.app.ActivityThread.main(ActivityThread.java:7664)
04-27 07:50:01.128: E/AndroidRuntime(21722): at java.lang.reflect.Method.invoke(Native Method)
04-27 07:50:01.128: E/AndroidRuntime(21722): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
04-27 07:50:01.128: E/AndroidRuntime(21722): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I remember the old implementation had a PR at some point to fix a null crash with request headers.
.setRequestHeaders( | ||
request.getRequestHeaders() != null | ||
? request.getRequestHeaders() | ||
: new HashMap<>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I remember the old implementation had a PR at some point to fix a null crash with request headers.
late bool isRedirect; | ||
late bool hasGesture; | ||
late String method; | ||
late Map<String?, String?> requestHeaders; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we do a body-less constructor using this.
references for the arguments, instead of everything being late?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea both formats are supported. I chose this one because it was less redundant (except for the late
keyword). I'm fine with either, though.
packages/webview_flutter/webview_flutter_android/pigeons/android_webview.dart
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
} | ||
|
||
class WebResourceErrorData { | ||
int? errorCode; | ||
String? description; | ||
WebResourceErrorData(this.errorCode, this.description); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same.
* c09ef582e [flutter_plugin_tools] Remove UWP (flutter/plugins#5432) * 3876f54bf [ci.yaml] Remove explicit caches (flutter/plugins#5434) * 0605d876d [webview_flutter_android] Updates `pigeon` version to support null safety (flutter/plugins#5395) * 4b687c9fa [video_player] Fix XCUITest based on the new tooltip accessibility label (flutter/plugins#5426) * e777e515b Roll Flutter from 1b58a59 to 4cea9af (147 revisions) (flutter/plugins#5437) * 656e8c443 Roll Flutter from 4cea9af to 5b71314 (4 revisions) (flutter/plugins#5441) * f689280bf [flutter_plugin_tools] Validate code blocks in readme-check (flutter/plugins#5436) * 9c41c6895 Roll Flutter from 5b71314 to 7a74222 (1 revision) (flutter/plugins#5442) * 160c714e7 Roll Flutter from 7a74222 to 2eed8cb (1 revision) (flutter/plugins#5443)
…#102824) * c09ef582e [flutter_plugin_tools] Remove UWP (flutter/plugins#5432) * 3876f54bf [ci.yaml] Remove explicit caches (flutter/plugins#5434) * 0605d876d [webview_flutter_android] Updates `pigeon` version to support null safety (flutter/plugins#5395) * 4b687c9fa [video_player] Fix XCUITest based on the new tooltip accessibility label (flutter/plugins#5426) * e777e515b Roll Flutter from 1b58a59 to 4cea9af (147 revisions) (flutter/plugins#5437) * 656e8c443 Roll Flutter from 4cea9af to 5b71314 (4 revisions) (flutter/plugins#5441) * f689280bf [flutter_plugin_tools] Validate code blocks in readme-check (flutter/plugins#5436) * 9c41c6895 Roll Flutter from 5b71314 to 7a74222 (1 revision) (flutter/plugins#5442) * 160c714e7 Roll Flutter from 7a74222 to 2eed8cb (1 revision) (flutter/plugins#5443)
Updates pigeon api to use null safety since flutter/flutter#59118 has added support for nullable parameters.
Also updates the pigeon file to include the output files. This removes the need for the
.generatePigeons.sh
script.No version change:
Only updates the
pigeon
api implementations.Pre-launch Checklist
dart format
.)[shared_preferences]
pubspec.yaml
with an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes.CHANGELOG.md
to add a description of the change, following repository CHANGELOG style.///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.