Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getUrl() throws an exception in flutter web app #2199

Open
2 tasks done
hossameldinmi opened this issue Jun 25, 2024 · 2 comments
Open
2 tasks done

getUrl() throws an exception in flutter web app #2199

hossameldinmi opened this issue Jun 25, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@hossameldinmi
Copy link

  • I have read the Getting Started section
  • I have already searched for the same problem

Environment

Technology Version
Flutter version 3.22.2
Plugin version 6.0.0
Android version
iOS version
macOS version
Xcode version 15.4
Google Chrome version 126.0.6478.63

Device information:
Macbook pro 2021, M1 Pro,

Description

Launch a flutter web app in chrome instance, I am using _controller.getUrl() method to get the current url of the frame
Expected behavior:
get the current url
Current behavior:
it gives null after throwing internal exception

Steps to reproduce

  1. Initiate webview component
  2. use _controller.getUrl(); method

Stacktrace/Logcat

TypeError: Cannot read properties of null (reading 'src') assets/packages/flutter_inappwebview_web/assets/web/web_support.js 366:34 getUrl dart-sdk/lib/_internal/js_dev_runtime/patch/js_patch.dart 145:53 callMethod packages/flutter_inappwebview_web/web/in_app_web_view_web_element.dart 249:21 [_callMethod] packages/flutter_inappwebview_web/web/in_app_web_view_web_element.dart 343:19 getUrl dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 127:5 _async packages/flutter_inappwebview_web/web/in_app_web_view_web_element.dart 342:25 getUrl packages/flutter_inappwebview_web/web/in_app_web_view_web_element.dart 115:22 handleMethodCall dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 127:5 _async packages/flutter_inappwebview_web/web/in_app_web_view_web_element.dart 67:35 handleMethodCall packages/flutter_inappwebview_web/web/in_app_web_view_web_element.dart 53:22 <fn> dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 127:5 _async packages/flutter_inappwebview_web/web/in_app_web_view_web_element.dart 51:42 <fn> packages/flutter/src/services/platform_channel.dart 571:55 _handleAsMethodCall dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 127:5 _async packages/flutter/src/services/platform_channel.dart 568:40 [_handleAsMethodCall] packages/flutter/src/services/platform_channel.dart 564:34 <fn> packages/flutter_web_plugins/src/plugin_registry.dart 125:33 handleFrameworkMessage dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 127:5 _async packages/flutter_web_plugins/src/plugin_registry.dart 116:38 handleFrameworkMessage lib/_engine/engine/platform_dispatcher.dart 721:7 [_sendPlatformMessage] lib/_engine/engine/platform_dispatcher.dart 414:5 sendPlatformMessage packages/flutter/src/services/binding.dart 558:27 send packages/flutter/src/services/platform_channel.dart 327:31 _invokeMethod dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 127:5 _async packages/flutter/src/services/platform_channel.dart 322:30 [_invokeMethod] packages/flutter/src/services/platform_channel.dart 507:12 invokeMethod packages/flutter_inappwebview_web/src/in_app_webview/in_app_webview_controller.dart 237:34 getUrl dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 127:5 _async packages/flutter_inappwebview_web/src/in_app_webview/in_app_webview_controller.dart 235:25 getUrl packages/flutter_inappwebview/src/in_app_webview/in_app_webview_controller.dart 48:40 getUrl packages/ynmo/view/internal_web_view.dart 98:33 [_getCurrentUrl] packages/ynmo/view/internal_web_view.dart 90:78 <fn> dart-sdk/lib/async/stream.dart 805:29 <fn> dart-sdk/lib/async/zone.dart 1594:9 runUnaryGuarded dart-sdk/lib/async/stream_impl.dart 365:5 [_sendData] dart-sdk/lib/async/stream_impl.dart 297:7 [_add] dart-sdk/lib/async/stream_controller.dart 784:5 [_sendData] dart-sdk/lib/async/stream_controller.dart 658:7 [_add] dart-sdk/lib/async/stream_controller.dart 606:5 add dart-sdk/lib/async/stream.dart 512:21 sendEvent dart-sdk/lib/async/stream.dart 531:13 <fn> dart-sdk/lib/_internal/js_dev_runtime/private/isolate_helper.dart 48:11 internalCallback

@hossameldinmi hossameldinmi added the bug Something isn't working label Jun 25, 2024
Copy link

👋 @hossameldinmi

NOTE: This comment is auto-generated.

Are you sure you have already searched for the same problem?

Some people open new issues but they didn't search for something similar or for the same issue. Please, search for it using the GitHub issue search box or on the official inappwebview.dev website, or, also, using Google, StackOverflow, etc. before posting a new one. You may already find an answer to your problem!

If this is really a new issue, then thank you for raising it. I will investigate it and get back to you as soon as possible. Please, make sure you have given me as much context as possible! Also, if you didn't already, post a code example that can replicate this issue.

In the meantime, you can already search for some possible solutions online! Because this plugin uses native WebView, you can search online for the same issue adding android WebView [MY ERROR HERE] or ios WKWebView [MY ERROR HERE] keywords.

Following these steps can save you, me, and other people a lot of time, thanks!

@Joao-Pimenta
Copy link

This is still an issue. Any news on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants