-
Notifications
You must be signed in to change notification settings - Fork 24
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
Migration file_picker to WASM support #212
Comments
Sure, one of the goals is to help migrate away from
There's some wrapping with lists going on with var firstChild = _target.firstChild;
while (firstChild != null) {
_target.removeChild(firstChild);
firstChild = _target.firstChild;
} This may not be the fastest (might be faster to remove the children starting from the end) or most idiomatic way, but it's the identical equivalent.
Use the events helpers in the helpers folder e.g. await EventStreamProviders.loadEvent.forTarget(reader).first; There's events.dart which tries to keep the same syntax as |
I will try it on the weekend, thanks a lot |
I still need support I tried to build with WASM but I got the following error
My migration |
With the new interop, you can't use the void changeEventListener(Event e) async {
// ...
} |
Thanks builds fine now 😍 |
I tried to run the app for testing and I got the following error: so how to convert NativeByteBuffer to Uint8List |
I used this conversion and it works fine now
|
My full PR for the reference |
Sidecasting an interop type to a Dart type may not work on both JS and Wasm.
This will definitely throw on dart2wasm. Instead, downcast to another interop type, and convert as needed. In this case, try: ByteBuffer? byteBuffer = (reader.result as JSArrayBuffer).toDart; I also see a String? result = (reader.result as JSString).toDart; See https://dart.dev/interop/js-interop/js-types#compatibility-type-checks-and-casts for more details. |
ok, I will update it, thanks a lot |
Presumably, analysis is smart enough to know that its value is non-nullable? This also gives me a hint: void main() {
int? x = 5;
x?.isEven;
} If you don't know if ByteBuffer? byteBuffer = (reader.result as JSArrayBuffer?)?.toDart; |
Thanks |
dart2wasm doesn't have a debugging mode yet unfortunately. |
I want to compile my app to WASM but I found that I need to migrate several libraries to WASM
So I started by migrating file_picker library
I don't know if here is the right place for asking support
I made the initial migration but I got two cases which I don't know how to migrate
Case 1:
_target.children.clear();
Case 2:
await reader.onLoad.first;
I wonder how to migrate these two cases
My commit after the initial attempt to migration
amrgetment/flutter_file_picker@1ded925
And I wonder if here is the right place to ask about migration support?
The text was updated successfully, but these errors were encountered: