shareXFiles static method
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.
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,
);
}