shareFiles 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.
The optional mimeTypes
parameter can be used to specify MIME types for
the provided files.
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
@Deprecated("Use shareXFiles instead.")
static Future<void> shareFiles(
List<String> paths, {
List<String>? mimeTypes,
String? subject,
String? text,
Rect? sharePositionOrigin,
}) {
assert(paths.isNotEmpty);
assert(paths.every((element) => element.isNotEmpty));
return _platform.shareFiles(
paths,
mimeTypes: mimeTypes,
subject: subject,
text: text,
sharePositionOrigin: sharePositionOrigin,
);
}