Open jthlim opened 1 month ago
small piece forgotten. lgtm 👍
I'm still unable to build wasm using flutter build web --wasm
after applying this patch, getting errors like below:
../../../.pub-cache/hosted/pub.flutter-io.cn/path_provider_windows-2.2.1/lib/src/path_provider_windows_real.dart:5:1: Error: 'dart:ffi' can't be imported when compiling to
Wasm.
import 'dart:ffi';
../../../.pub-cache/hosted/pub.flutter-io.cn/path_provider_linux-2.2.1/lib/src/get_application_id_real.dart:5:1: Error: 'dart:ffi' can't be imported when compiling to Wasm.
import 'dart:ffi';
^
Is there a way to import path_provider_windows
and path_provider_linux
merely on Windows / Linux to avoid them interrupting wasm build?
That looks like an issue with path_provider - not with file_saver. You should post issues related to path_provider in that repo, not file_saver.
That looks like an issue with path_provider - not with file_saver. You should post issues related to path_provider in that repo, not file_saver.
It should be, but the path_provider_windows
and _linux
dependencies are declared in file_saver
's pubspec.yaml
and imported in utils/helpers.dart
, causing wasm build failure. Tried to remove those (use path_provider
only, on all desktop platforms) and wasm was built correctly, but I'm not sure if it will build and work correctly on Windows and Linux.
The current file_saver builds for wasm, but trying to use it immediately fails with "Cannot create PlatformHandler"
This is because the conditional import on dart.library.html does not happen on wasm.
From https://dart.dev/interop/js-interop/package-web#conditional-imports
This shows that dart.library.html should be replaced with dart.library.js_interop
This PR does just that.
With this change, I have tested that I get a working file save under wasm now.