flutter-share icon indicating copy to clipboard operation
flutter-share copied to clipboard

Cannot share raw file on android.

Open tommaso1 opened this issue 6 years ago • 2 comments

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

tommaso1 avatar Nov 14 '18 11:11 tommaso1

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);

mraabs avatar Nov 14 '18 19:11 mraabs

after replacing the path address with 'file://$filePath/s.jpg' my problem got resolved.

mraabs avatar Nov 22 '18 16:11 mraabs