dart-windows / win32

Build Win32 apps with Dart!
https://win32.pub
BSD 3-Clause "New" or "Revised" License
735 stars 118 forks source link

Dependency error: imported when compiling to Wasm. #854

Closed Trung15010802 closed 1 week ago

Trung15010802 commented 1 week ago

I got this error when build flutter with Wasm image

domesticmouse commented 1 week ago

I don't see a way that Win32 API access could possibly work from within the WASM sandbox.

What are you expecting to be able to do here?

jpohhhh commented 6 days ago

FWIW there is something strange going on, I can't quite wrap my mind around it.

TL;DR:

Full notes:

import 'package:telosnex/extensions/win32/win32_stub.dart'
    if (dart.library.io) 'package:telosnex/extensions/win32/win32_io.dart'
    if (dart.library.html) 'package:telosnex/extensions/win32/win32_web.dart';

to

import 'package:telosnex/extensions/win32/win32_stub.dart'
    if (dart.library.js_interop) 'package:telosnex/extensions/win32/win32_web.dart'
    if (dart.library.io) 'package:telosnex/extensions/win32/win32_io.dart';

(note precedence, putting js_interop first, as well as using js_interop instead of HTML)

This didn't work. But, removing that code altogether didn't work. I'm guessing a package I depend on depends on win32 and has the "wrong" type of conditional import that either needs to be patched, or will work after stable gets the fix.

I was just trying WASM compile, expecting it not to work, so I'm not actively pursuing this. Especially with the state being confusing to me before Flutter updates shortly.

But I figured I should give you a heads up, w/full context, in case you see more issues reported (I see in vector_graphics and flutter threads, win32 is also mentioned, so you might see more)