superlistapp / super_native_extensions

Native drag & drop, clipboard access and context menu.
MIT License
458 stars 84 forks source link

The argument type 'HitTestResult Function()' can't be assigned to the parameter type 'HitTestResult?' #260

Closed darkomenx closed 10 months ago

darkomenx commented 10 months ago

Technical information :

Error :

`Launching lib\main.dart on Windows in debug mode...
Building Windows application...
/C:/Users/toto/AppData/Local/Pub/Cache/hosted/pub.dev/super_drag_and_drop-0.3.0+2/lib/src/drag_internal.dart(146,41): error GC2F972A8: The argument type 'HitTestResult Function()' can't be assigned to the parameter type 'HitTestResult?'. 

[C:\PROJECT\ANDROIDStudio\MyBestProject\build\windows\x64\flutter\flutter_assemble.vcxproj]

C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(248,5): error MSB8066: la build personnalis�e de 'C:\PROJECT\ANDROIDStudio\MyBestProject\build\windows\x64\CMakeFiles\e06ad74d88d57f94f34b2c209e55916f\flutter_windows.dll.rule;

C:\PROJECT\ANDROIDStudio\MyBestProject\build\windows\x64\CMakeFiles\468867c259ba90e51417479bb0316122\flutter_assemble.rule' s'est arr�t�e. Code�1. [C:\PROJECT\ANDROIDStudio\MyBestProject\build\windows\x64\flutter\flutter_assemble.vcxproj]
Exception: Build process failed.`

Context :

I want to use the super_drag_and_drop. I launch : flutter pub add super_drag_and_drop I launch and install Rust program with the rustup-init.exe provided I upgrade Rust with rustup upgrade I imported package like this : 'import 'package:super_drag_and_drop/super_drag_and_drop.dart';' I use package like this (basic just for first try) :

                      DropRegion(
                        formats: Formats.standardFormats,
                        onDropOver: (DropOverEvent)
                        {
                          final item = DropOverEvent.session.items.first;
                          if (item.localData is Map) {
                            // This is a drag within the app and has custom local data set.
                          }
                          if (item.canProvide(Formats.plainText)) {
                            // this item contains plain text.
                          }
                          // This drop region only supports copy operation.
                          if (DropOverEvent.session.allowedOperations.contains(DropOperation.copy)) {
                            return DropOperation.copy;
                          } else {
                            return DropOperation.none;
                          }
                        },
                        onDropEnter: (event) {},
                        onDropLeave: (event) {},
                        onPerformDrop: (PerformDropEvent) async
                        {
                          final item = PerformDropEvent.session.items.first;

                          // data reader is available now
                          final reader = item.dataReader!;

                          if (reader.canProvide(Formats.plainText))
                          {
                            reader.getValue<String>(Formats.plainText, (value) {
                              if (value != null) {
                                // You can access values through the `value` property.
                                print('Dropped text: ${value}');
                              }
                            }, onError: (error) {
                              print('Error reading value $error');
                            });
                          }

                          if (reader.canProvide(Formats.png))
                          {
                            reader.getFile(Formats.png, (file) {
                              final stream = file.getStream();
                            }, onError: (error) {
                              print('Error reading value $error');
                            });
                          }
                        },
                        child: const Padding(
                          padding: EdgeInsets.all(15.0),
                          child: Text('Drop items here'),
                        ),
                      )

Questions :

Thank you for your help

knopp commented 10 months ago

You seem to be using a very old version of super_drag_and_drop (0.3.0). Last version at pub.dev is 0.7.3.

darkomenx commented 10 months ago

Thank you for your very speed response.

I use this command for install package : flutter pub add super_drag_and_drop Whereas it installed the old version.

If I force to install 0.7.3 latest version it tell me that exist conflict with

I will investigate around this and return here to keep track

knopp commented 10 months ago

Please reopen if this is not resolved.