Closed prafgup closed 4 years ago
Is the function available in latest package?
@Deepanshu-Rohilla , no its not available yet but I figured it out.
@Deepanshu-Rohilla
Here is the solution to share a list of files with different extensions can be any Media Type. The map basically maps the filename with extension to Uint8List bytes of media
downloadFiles(List<Media> mediaList, {String optionalText = ''}) async {
Map<String, Uint8List> shareMap = {};
for (var media in mediaList) {
currentIndex = mediaList.indexOf(media) + 1;
var request = await HttpClient().getUrl(Uri.parse(media.networkURL));
var response = await request.close();
String extension = response.headers.contentType.toString().split('/')[1];
Uint8List bytes = await consolidateHttpClientResponseBytes(response);
shareMap[media.createDate.toString().trim() + '.' + extension] = bytes;
}
await Share.files(
optionalText,
shareMap,
'*/*',
text: "Shared via PixShare app",
);
}
Is it possible to share multiple images and videos simultaneously ?