shareXFiles static method

Future<ShareResult> shareXFiles(
  1. List<XFile> files, {
  2. String? subject,
  3. String? text,
  4. Rect? sharePositionOrigin,
})

Summons the platform's share sheet to share multiple files.

Wraps the platform's native share dialog. Can share a file. It uses the ACTION_SEND Intent on Android and UIActivityViewController on iOS.

Android supports all natively available MIME types (wildcards like image/* are also supported) and it's considered best practice to avoid mixing unrelated file types (eg. image/jpg & application/pdf). If MIME types are mixed the plugin attempts to find the lowest common denominator. Even if MIME types are supplied the receiving app decides if those are used or handled. On iOS image/jpg, image/jpeg and image/png are handled as images, while every other MIME type is considered a normal file.

The optional sharePositionOrigin parameter can be used to specify a global origin rect for the share sheet to popover from on iPads and Macs. It has no effect on other devices.

May throw PlatformException or FormatException from MethodChannel.

See documentation about ShareResult on share method.

Implementation

static Future<ShareResult> shareXFiles(
  List<XFile> files, {
  String? subject,
  String? text,
  Rect? sharePositionOrigin,
}) async {
  assert(files.isNotEmpty);
  return _platform.shareXFiles(
    files,
    subject: subject,
    text: text,
    sharePositionOrigin: sharePositionOrigin,
  );
}