Skip to content
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

Drag/Dropping a file failing on Linux #503

Open
hobleyd opened this issue Mar 13, 2025 · 0 comments
Open

Drag/Dropping a file failing on Linux #503

hobleyd opened this issue Mar 13, 2025 · 0 comments

Comments

@hobleyd
Copy link

hobleyd commented Mar 13, 2025

Hi,

I have written some code to drag/drop files which works on MacOS but fails on Linux. The code which handles the drop is:

Future<void> onPerformDrop(PerformDropEvent event) async {
  if (event.session.items.isNotEmpty) {
    for (var item in event.session.items) {
      final reader = item.dataReader!;
      if (reader.canProvide(Formats.fileUri)) {
        reader.getValue(Formats.fileUri, (uri) async {
          if (uri != null) {
            Uri toFileUri = Uri.parse('${destination.uri}${basename(Uri.decodeComponent(uri.path))}');

            // do stuff with the dropped file.
            };
          }
        });
      }
    }
  }
}

On linux, the reader.getValue function appears to provide a null URI even though the supported formats indicate that text/uri-list is acceptable:

[text/plain;charset=utf-8, text/uri-list, application/vnd.portal.files, application/vnd.portal.filetransfer, application/x-gtk-local-dnd, text/plain]

An ideas what I am doing wrong please?

Cheers,
David

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant