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.
The optional parameter fileNameOverrides
can be used to override the names of shared files
When set, the list length must match the number of files
to share.
This is useful when sharing files that were created by XFile.fromData
,
because name property will be ignored by cross_file
on all platforms except on web.
May throw PlatformException
or FormatException
from MethodChannel.
See documentation about ShareResult on share method.
Implementation
@Deprecated('Use SharePlus.instance.share() instead')
static Future<ShareResult> shareXFiles(
List<XFile> files, {
String? subject,
String? text,
Rect? sharePositionOrigin,
List<String>? fileNameOverrides,
}) async {
assert(files.isNotEmpty);
return SharePlus.instance.share(
ShareParams(
files: files,
subject: subject,
text: text,
sharePositionOrigin: sharePositionOrigin,
fileNameOverrides: fileNameOverrides,
downloadFallbackEnabled: downloadFallbackEnabled,
),
);
}