You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
A random filename is assigned to files that have no filename set
A note that XFile.fromData ignores the the filename
I am aware that cross_file is a separate project, but at least when navigating the API docs it is not possible to find this information.
Plugin
share_plus
Use case
When sharing a file that is created from data, like so
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 thename
parameter, when creating an xFile via the fromData constructor see cross_file/lib/src/types/io.dart:43This 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
XFile.fromData
ignores the the filenameThe text was updated successfully, but these errors were encountered: