file static method

Future<void> file(
  1. String title,
  2. String name,
  3. List<int> bytes,
  4. String mimeType, {
  5. String text = '',
})

Sends a file to other apps.

Implementation

static Future<void> file(
    String title, String name, List<int> bytes, String mimeType,
    {String text = ''}) async {
  Map argsMap = <String, String>{
    'title': title,
    'name': name,
    'mimeType': mimeType,
    'text': text
  };

  final tempDir = await getTemporaryDirectory();
  final file = await File('${tempDir.path}/$name').create();
  await file.writeAsBytes(bytes);

  _channel.invokeMethod('file', argsMap);
}