-2

I would like to share the image of a card widget along with some standard text using a Share button. While I have been able to convert the card into an image using capturePng, how can I use the result of capturePng to share it as an image via other apps? I'm not sure that the share plugin allows for sharing images.

LuckyStrike
  • 69
  • 1
  • 10
  • Does this answer your question? [How do I share an image on iOS and Android using Flutter?](https://stackoverflow.com/questions/44181343/how-do-i-share-an-image-on-ios-and-android-using-flutter) –  Apr 08 '20 at 16:07

1 Answers1

0

You can use this package to share files https://pub.dev/packages/esys_flutter_share

Future<void> _shareMixed() async {
    try {
      final ByteData bytes1 = await rootBundle.load('assets/image1.png');
      final ByteData bytes2 = await rootBundle.load('assets/image2.png');
      final ByteData bytes3 = await rootBundle.load('assets/addresses.csv');

      await Share.files(
          'esys images',
          {
            'esys.png': bytes1.buffer.asUint8List(),
            'bluedan.png': bytes2.buffer.asUint8List(),
            'addresses.csv': bytes3.buffer.asUint8List(),
          },
          '*/*',
          text: 'My optional text.');
    } catch (e) {
      print('error: $e');
    }
  }

full example can be found in following link code

Nidheesh MT
  • 1,074
  • 11
  • 18