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

A message on the desktop_drop channel was discarded before it could be handled. #69

Closed utkarsh-karnik closed 11 months ago

utkarsh-karnik commented 11 months ago

I've implemented your package . But Now I got the problem while trying to upload the files for 2nd time . First time I Can upload the files easily , But after that when I try to drag & drop it is showing me error like that .

A message on the desktop_drop channel was discarded before it could be handled.
This happens when a plugin sends messages to the framework side before the framework has had an opportunity to register a listener. See the ChannelBuffers API documentation for details on how to configure the channel to expect more messages, or to expect messages to get discarded:
  https://api.flutter.dev/flutter/dart-ui/ChannelBuffers-class.html
Error: MissingPluginException(No implementation found for method updated on channel desktop_drop)
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 288:49  throw_
packages/flutter/src/services/platform_channel.dart 308:7                     _invokeMethod
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50            <fn>
dart-sdk/lib/async/zone.dart 1661:54                                          runUnary
dart-sdk/lib/async/future_impl.dart 147:18                                    handleValue
dart-sdk/lib/async/future_impl.dart 784:44                                    handleValueCallback
dart-sdk/lib/async/future_impl.dart 813:13                                    _propagateToListeners
dart-sdk/lib/async/future_impl.dart 584:5                                     [_completeWithValue]
dart-sdk/lib/async/future_impl.dart 657:7                                     callback
dart-sdk/lib/async/schedule_microtask.dart 40:11                              _microtaskLoop
dart-sdk/lib/async/schedule_microtask.dart 49:5                               _startMicrotaskLoop
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 177:15           <fn>
Error: MissingPluginException(No implementation found for method performOperation_web on channel desktop_drop)
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 288:49  throw_

Here is my Code Snippet to understand you better

DropzoneView(
                                          operation: DragOperation.move,
                                          onCreated: (ctrl) =>
                                              controller1 = ctrl,
                                          onLoaded: () => print('Zone loaded'),
                                          onError: (String? ev) =>
                                              print('Error: $ev'),
                                          onHover: () => print('Zone hovered'),
                                          onDrop: (dynamic ev) async {
                                            print('Zone 2 drop: ${ev.name}');
                                            final stream = await controller1
                                                .getFileData(ev);
                                            setState(() {
                                              dummyText = '${ev.name} dropped';
                                              _pickedImages.add(stream);
                                            });
                                          },
                                          onDropMultiple: (dynamic ev) async {
                                            print('Zone 2 drop: ${ev.name}');
                                            final stream = await controller1
                                                .getFileData(ev);
                                            setState(() {
                                              dummyText = '${ev.name} dropped';
                                              _pickedImages.addAll(controller1.getFileData(ev) as Iterable<Uint8List>);
                                            });
                                          },
                                          onLeave: () => print('Zone left'),
                                          mime: const ['image/jpeg'],
                                        ),
deakjahn commented 11 months ago

The error message you quote speaks about the desktop_drop plugin so, I'm afraid, that's where you need to ask for help. :-)

I'm not sure you need both plugins at the same time.