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

Error: 'dart:ffi' can't be imported when compiling to Wasm. #1576

Closed
BirjuVachhani opened this issue Sep 18, 2024 · 2 comments
Closed

Error: 'dart:ffi' can't be imported when compiling to Wasm. #1576

BirjuVachhani opened this issue Sep 18, 2024 · 2 comments

Comments

@BirjuVachhani
Copy link

Unable to compile to Wasm because of ffi package. I don't use ffi directly but other packages I am using relies on it. I am assuming ffi package doesn't support wasm compilation yet!

Error: 'dart:ffi' can't be imported when compiling to Wasm.
                     import 'dart:ffi';

@mkustermann
Copy link
Member

@BirjuVachhani Then either the package doesn't work on the web or the package uses conditional imports that need to be fixed. Please see the exact dependencies that led to the import of dart:ffi and see if any of them is relying on conditional imports. If so, then they may need to be fixed (e.g. most common issue: import ... if (dart.library.html) needs to be replaced with import ... if (dart.library.js_interop) ... - as dart:html is only available in dart2js but not dart2wasm - see dart-lang/sdk#56358)

Adding FFI support on the web is a long standing issue that is tracked here: dart-lang/sdk#46690

@BirjuVachhani
Copy link
Author

Ah! I see. Thank you @mkustermann for your response and helpful insights. 🙌🏻 I'll look for them and report to respective package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants