deakjahn / flutter_dropzone

A drag-and-drop Flutter plugin (Web). Only web and only from outside into Flutter.
https://pub.dev/packages/flutter_dropzone
85 stars 36 forks source link

v4.0.0 : type 'NativeByteBuffer' is not a subtype of type 'List' in web/packages/flutter_dropzone_web/flutter_dropzone_web.dart.lib.js 236:44 getFileStream #86

Open tototo23 opened 2 months ago

tototo23 commented 2 months ago

Hi, I don't know when it started, but it looks like since I updated my project to Flutter 3.22, dropping a file in web doesn't work anymore. I'm using chrome version 124.0.6367.210 flutter_dropzone: ^4.0.0 Flutter 3.22.1

It looks like the JS file type changed : it used to return a Stream<List<int>>, and now it returns a minified:ix<List<int>> Just using this code :

DropzoneView(
   ...
  onDrop: (dynamic htmlFile) async {
          print('Drop: $htmlFile');
          var stream = controller.getFileStream(htmlFile);
          print('File stream type is : ${stream.runtimeType}');
          ...
   },
   ...
)

getFileStream(htmlFile) is supposed to return an object typed : Stream<List>. But i checked in runtime : Displays in the console :

Drop: Instance of 'minified:li'
File stream type is : minified:ix<List<int>>

It worked very well until I updated to Flutter 3.22, but i don't know if it's the reason...

deakjahn commented 2 months ago

Is this in the example inside the package or your own code? The first still looks OK to me.

tototo23 commented 2 months ago

Hi @deakjahn it's just a simple use of the package as documented here : https://pub.dev/packages/flutter_dropzone

I use a DropzoneView widget, and just display the type of controller.getFileStream(htmlFile).

I'm using library v4.0.4 with Flutter 3.22.1. I was reading the code, but now i see in the console an other error :

Uncaught MissingPluginException(No implementation found for method updated on channel desktop_drop)

So this is probably the source error, i'll try to investigate or see if i'm missing something...

tototo23 commented 2 months ago

I reverted to flutter_dropzone: 3.0.7 and it works well again. I'll stay with this version for now :)

deakjahn commented 2 months ago

It would be better for mankind if you found the error. ;-)) Yes, we moved on to the new HTML support in Flutter and that might still be a moving target. But they urged us to make the change ASAP...

tototo23 commented 2 months ago

The only errors I had and were able to investigate are :

I'll try to check when i'll have more time :/

tototo23 commented 2 months ago

I've got an update :

Hope it helps

deakjahn commented 2 months ago

I got a _ControllerStream all right but I didn't yet try release, just debug. It should be OK, we don't really care what kind of Stream it is as long as it's a Stream.

"minified" is something only in release, the JS obfuscation step.