flutter_rust_bridge icon indicating copy to clipboard operation
flutter_rust_bridge copied to clipboard

Dart2Wasm not working because of dart:js_util usage

Open flowhorn opened this issue 6 months ago • 3 comments

Describe the bug

In src/dart_opaque/_web.dart the dart:js_util package is used for the allowInterop Function. This prevents flutter from building using dart2wasm. As other parts of the app were already adjusted to js_interop, I wanted to notify you about this.

According to the docs, this should no longer be necessary and can be replaced by a .toJS Function (https://dart.dev/interop/js-interop/past-js-interop#dart-js_util). As I am not so confident in checking whether this directly works, I didn't directly created a PR (I can file a PR if this is desired)

Also it might be useful to increase the web package from ^0.5.1 to ">=0.5.1 <2.0.0" or even bump it to "1.0.0"

Steps to reproduce

Run: flutter build web --wasm.

Logs

../../../.pub-cache/hosted/pub.dev/flutter_rust_bridge-2.2.0/lib/src/dart_opaque/_web.dart:1:1: Error: JS interop library 'dart:js_util' can't be imported
when compiling to Wasm.
Try using 'dart:js_interop' or 'dart:js_interop_unsafe' instead.
import 'dart:js_util';

Expected behavior

No response

Generated binding code

No response

OS

No response

Version of flutter_rust_bridge_codegen

2.2.0

Flutter info

No response

Version of clang++

No response

Additional context

No response

flowhorn avatar Aug 09 '24 09:08 flowhorn