Fixed the unexpected behavior of InAppWebView and HeadlessInAppWebView when initialUrlRequest was set as null.

This commit is contained in:
RodXander 2021-12-22 16:51:38 -06:00
parent f06bcdf695
commit 440ff81803
2 changed files with 4 additions and 12 deletions

View File

@ -139,9 +139,7 @@ class HeadlessInAppWebView implements WebView {
args.putIfAbsent(
'params',
() => <String, dynamic>{
'initialUrlRequest': (this.initialUrlRequest ??
URLRequest(url: Uri.parse("about:blank")))
.toMap(),
'initialUrlRequest': this.initialUrlRequest?.toMap(),
'initialFile': this.initialFile,
'initialData': this.initialData?.toMap(),
'initialOptions': this.initialOptions?.toMap() ?? {},

View File

@ -395,9 +395,7 @@ class _InAppWebViewState extends State<InAppWebView> {
viewType: 'com.pichillilorenzo/flutter_inappwebview',
layoutDirection: TextDirection.rtl,
creationParams: <String, dynamic>{
'initialUrlRequest': (widget.initialUrlRequest ??
URLRequest(url: Uri.parse("about:blank")))
.toMap(),
'initialUrlRequest': widget.initialUrlRequest?.toMap(),
'initialFile': widget.initialFile,
'initialData': widget.initialData?.toMap(),
'initialOptions': widget.initialOptions?.toMap() ?? {},
@ -425,9 +423,7 @@ class _InAppWebViewState extends State<InAppWebView> {
gestureRecognizers: widget.gestureRecognizers,
layoutDirection: TextDirection.rtl,
creationParams: <String, dynamic>{
'initialUrlRequest': (widget.initialUrlRequest ??
URLRequest(url: Uri.parse("about:blank")))
.toMap(),
'initialUrlRequest': widget.initialUrlRequest?.toMap(),
'initialFile': widget.initialFile,
'initialData': widget.initialData?.toMap(),
'initialOptions': widget.initialOptions?.toMap() ?? {},
@ -448,9 +444,7 @@ class _InAppWebViewState extends State<InAppWebView> {
onPlatformViewCreated: _onPlatformViewCreated,
gestureRecognizers: widget.gestureRecognizers,
creationParams: <String, dynamic>{
'initialUrlRequest': (widget.initialUrlRequest ??
URLRequest(url: Uri.parse("about:blank")))
.toMap(),
'initialUrlRequest': widget.initialUrlRequest?.toMap(),
'initialFile': widget.initialFile,
'initialData': widget.initialData?.toMap(),
'initialOptions': widget.initialOptions?.toMap() ?? {},