files static method

Future<void> files(
  1. String title,
  2. Map<String, List<int>> files,
  3. String mimeType, {
  4. String text = '',
})

Sends multiple files to other apps.

Implementation

static Future<void> files(
    String title, Map<String, List<int>> files, String mimeType,
    {String text = ''}) async {
  Map argsMap = <String, dynamic>{
    'title': title,
    'names': files.entries.toList().map((x) => x.key).toList(),
    'mimeType': mimeType,
    'text': text
  };

  final tempDir = await getTemporaryDirectory();

  for (var entry in files.entries) {
    final file = await File('${tempDir.path}/${entry.key}').create();
    await file.writeAsBytes(entry.value);
  }
  _channel.invokeMethod('files', argsMap);
}