0

I am using the following plugin to share files in my flutter app:

[Flutter Share Plugin][1]

Here's how I use it my code:

  new IconButton(icon: new Icon(FontAwesomeIcons.download, size: 35),
                onPressed:  ()  {
                  final RenderBox box = context.findRenderObject();
                  Share.image(path: "file:../assets/lake.jpg",mimeType: ShareType.TYPE_IMAGE,title: "title",text:"text").share(
                                  sharePositionOrigin: box.localToGlobal(Offset.zero) & box.size);
                },
              ),"SHARE"),

Notice the path is set to ../assets/lake.jpg. This is because this dart file resides under lib/pages folder whereas the picture that I am trying to access is under assets folder.

Here's the screenshot:

My project structure

When I click on the share button, the share box comes up and when I try to share the image via whatsapp for example, it even asks me "Share with Mr. X"?

However, it does not share anything and does not give me any sort of error message.

mcfred
  • 1,183
  • 2
  • 29
  • 68
  • https://github.com/flutter/flutter/issues/19607, https://github.com/flutter/flutter/issues/9817, https://github.com/flutter/plugins/pull/970 There should be other plugins in pub.dartlang.org that already support sharing with files. – Günter Zöchbauer Jan 22 '19 at 12:30
  • I wrote a detailed tutorial how to implement the share mechanism in Flutter using channels, maybe you want to do it own your own too https://medium.com/jademind/a-flutter-channel-to-share-a-file-on-ios-and-android-94f03e8aca9d – anka Nov 30 '19 at 18:50

0 Answers0