Issue with JSAny for web#2360
Conversation
|
I was able to compile using Here is the
|
|
@pichillilorenzo after building it with wasm, did you also force it to launch as wasm, not canvaskit? https://docs.flutter.dev/platform-integration/web/wasm#build-or-run-the-app-flutter-build-web-wasm |
|
@alikamal1 @pichillilorenzo Hi guys! I tested both of your variants. I also encountered the same issue as @alikamal1: Flutter 3.24.4 |
|
We also can run wasm app by |
|
@alikamal1 I could merge this PR to resolve the error on WASM, but it seems that when it is compiled with it, the iframe is not positioned correctly as you can see from @ArturLevchuk example (tested also by myself). Also, using WASM doesn't load the same iframe of the example that is loading and rendering correctly without it! |
@pichillilorenzo This issue of the iframe position seems related to the current Flutter stable version. I am not sure what is causing the issue, but it seems to be working fine on master channel (3.27.0-1.0.pre.11) as shown in the screenshot below
yes, because the nature of |
| external JSWebView createFlutterInAppWebView( | ||
| JSAny viewId, HTMLIFrameElement iframe, HTMLDivElement iframeContainer); | ||
| String viewId, HTMLIFrameElement iframe, HTMLDivElement iframeContainer); |
There was a problem hiding this comment.
You should also update type in flutter_inappwebview_web/lib/assets/web/web_support.js and in nativeCommunication-related code:
flutter_inappwebview_web/lib/web/web_platform.dart:JSAny viewId,dynamic viewIdflutter_inappwebview_web/lib/web/web_platform_manager.dart:webViewsshould haveMap<String, dynamic>typeflutter_inappwebview_web/lib/web/in_app_web_view_web_element.dart:dynamic _viewId- other places where
viewIdis used asintordynamic
As is, this PR could break functionality for cases where viewId is still used as int.
There was a problem hiding this comment.
thank you @p-mazhnik .. I edited the part of flutter_inappwebview_web\lib\web\web_platform.dart to change int to string .. other parts are dynamic which should work without breaking functionality.
There was a problem hiding this comment.
@alikamal1 i tried your solution after this changes. now it fails :(

There was a problem hiding this comment.
@alikamal1 also as mentioned @p-mazhnik with String value only changed here it brokes callbacks like 'onLoadStart' , 'onLoadStop'... But if we passing value like (_viewId as int).toJS it works. Anyway callbacks on wasm mode still dead. I tested your solution on version 6.1.5 because on 6.2 callbacks dead on web in general
This reverts commit 2239a68.
|
Sorry guys, I will take a look at it deeper as soon as possible as I’m currently working on the 6.2.0 beta release, thanks! |
|
I managed to fix the issue. The problem was really simple, the _viewId is int ? (_viewId as int).toJS : _viewId.toString().toJSThanks to everyone. |
|
When is 6.2 stable release planned? @pichillilorenzo |



During build with
flutter build web --wasmand when open inappwebview there is type errorConnected to #2067
After updating the type from JSAny to String the webview works