Skip to content

[Request]: Improve documentation for filename used in shareXFiles #3032

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

Closed
frieder-audriga opened this issue Jun 28, 2024 · 2 comments · Fixed by #3077
Closed

[Request]: Improve documentation for filename used in shareXFiles #3032

frieder-audriga opened this issue Jun 28, 2024 · 2 comments · Fixed by #3077
Labels
enhancement New feature or request triage

Comments

@frieder-audriga
Copy link
Contributor

Plugin

share_plus

Use case

When sharing a file that is created from data, like so

      var data = utf8.encode('Hello World');
      var fileName = 'myFile.txt';
      var mimeType = 'text/plain';
      var xFile = XFile.fromData(data, name: fileName, mimeType: mimeType);
      Share.shareXFiles([xFile]);

expected behavior would be that a file called "myFile.txt" would be shared. Instead "{randomUUID}.txt" gets shared.

This is caused by cross_file ignoring the name parameter, when creating an xFile via the fromData constructor see cross_file/lib/src/types/io.dart:43

This then causes share_plus to assign a name based on a random UUIDv6 and the mimetype.

Proposal

Ideally a convenient way (for example an optional parameter) would be introduced that allows us to set/ override the filename of a given file to share.

But if that is not wanted for some reason at least please add to the documentation that

@frieder-audriga
Copy link
Contributor Author

Note: I am not the only one that is confused by this, see #1548 (comment) and following comments

@vbuberen
Copy link
Collaborator

vbuberen commented Jul 2, 2024

Thanks for reporting. PR is more than welcome with your suggestion.

frieder-audriga added a commit to frieder-audriga/plus_plugins that referenced this issue Jul 5, 2024
…reXFiles`.

This enables file names to be set for XFiles created from data.
See issue [fluttercommunity#3032](fluttercommunity#3032)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request triage
Projects
None yet
2 participants