Skip to content

Commit fe51dda

Browse files
web: Fixed 'Type 'int' is not a subtype of type 'JSValue' in type cast' when compiling/running using WASM
1 parent c23a014 commit fe51dda

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

flutter_inappwebview/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Implemented security features to better manage access to the native javascript b
5959

6060
#### Web Platform
6161
- Merged "[web] support iframe role and aria-hidden attributes" [2293](https://github.com/pichillilorenzo/flutter_inappwebview/pull/2293) (thanks to [p-mazhnik](https://github.com/p-mazhnik))
62+
- Fixed 'Type 'int' is not a subtype of type 'JSValue' in type cast' when compiling/running using WASM
6263

6364
## 6.1.5
6465

flutter_inappwebview_web/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
- Updated flutter_inappwebview_platform_interface version to ^1.4.0
44
- Merged "[web] support iframe role and aria-hidden attributes" [2293](https://github.com/pichillilorenzo/flutter_inappwebview/pull/2293) (thanks to [p-mazhnik](https://github.com/p-mazhnik))
5+
- Fixed 'Type 'int' is not a subtype of type 'JSValue' in type cast' when compiling/running using WASM
56

67
## 1.1.2
78

flutter_inappwebview_web/lib/web/in_app_web_view_web_element.dart

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import 'dart:async';
2-
import 'dart:typed_data';
3-
import 'dart:ui';
2+
import 'dart:developer';
3+
import 'dart:js_interop';
4+
45
import 'package:flutter/services.dart';
56
import 'package:flutter_inappwebview_platform_interface/flutter_inappwebview_platform_interface.dart';
6-
import 'dart:js_interop';
7-
import 'dart:developer';
87
import 'package:web/web.dart';
98

109
import 'headless_inappwebview_manager.dart';
11-
import 'web_platform_manager.dart';
1210
import 'js_bridge.dart';
11+
import 'web_platform_manager.dart';
1312

1413
extension on HTMLIFrameElement {
1514
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/csp
1615
external set csp(String? value);
16+
1717
external String? get csp;
1818
}
1919

@@ -65,7 +65,9 @@ class InAppWebViewWebElement implements Disposable {
6565
});
6666

6767
jsWebView = flutterInAppWebView?.createFlutterInAppWebView(
68-
_viewId, iframe, iframeContainer);
68+
_viewId is int ? (_viewId as int).toJS : _viewId.toString().toJS,
69+
iframe,
70+
iframeContainer);
6971
}
7072

7173
/// Handles method calls over the MethodChannel of this plugin.
@@ -208,7 +210,9 @@ class InAppWebViewWebElement implements Disposable {
208210
initialFile = webView.initialFile;
209211

210212
jsWebView = flutterInAppWebView?.createFlutterInAppWebView(
211-
_viewId, iframe, iframeContainer);
213+
_viewId is int ? (_viewId as int).toJS : _viewId.toString().toJS,
214+
iframe,
215+
iframeContainer);
212216
}
213217
}
214218
}

0 commit comments

Comments
 (0)