How do I share multi image on iOS and Android using Flutter?

412

You can use package https://pub.dev/packages/esys_flutter_share
To share multiple files or images with Share.files

code snippet

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.');
Share:
412
Masoud
Author by

Masoud

Android , java , kotlin , flutter

Updated on December 21, 2022

Comments

  • Masoud
    Masoud over 1 year

    I would like to share multi image using the standard share dialog in ios and Android.

    How can I create a "share" button for multi image using flutter.

    I found some code like this for share an image

    final ByteData bytes = await rootBundle.load('assets/image1.png');
    await Share.file('esys image', 'esys.png', bytes.buffer.asUint8List(), 'image/png');