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( args.putIfAbsent(
'params', 'params',
() => <String, dynamic>{ () => <String, dynamic>{
'initialUrlRequest': (this.initialUrlRequest ?? 'initialUrlRequest': this.initialUrlRequest?.toMap(),
URLRequest(url: Uri.parse("about:blank")))
.toMap(),
'initialFile': this.initialFile, 'initialFile': this.initialFile,
'initialData': this.initialData?.toMap(), 'initialData': this.initialData?.toMap(),
'initialOptions': this.initialOptions?.toMap() ?? {}, 'initialOptions': this.initialOptions?.toMap() ?? {},

View File

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