flutter-share
flutter-share copied to clipboard
Cannot share raw file on android.
Gmail says it cannot add the file as attachment.
await Share.file(title: 'dump.dat', path: path, text: 'Dump').share();
it says no error. But path is correct and i can read file from within the app at that given path
I have a similar problem. I used the following code to share an image. However, I cannot share the image. Different apps give different reasons. Messages: Unable to load the file, Bluetooth: Unknow file format. Gmail: Cannot attach an empty file. BTW, the app already has the read and write permission.
Future<String> get _localPath async {
final dir = await getExternalStorageDirectory();
return dir.path;
}
...
filePath = await _localPath;
...
await Share.image(
path: '$filePath/s.jpg',
title: "Spark It!",
text: "Spark it! Find us in playstore",
mimeType: ShareType.TYPE_IMAGE)
.share(sharePositionOrigin: cardRect);
after replacing the path address with 'file://$filePath/s.jpg'
my problem got resolved.