shareFileToWhatsApp method

Future shareFileToWhatsApp({
  1. required String? filePath,
  2. required String fileProviderPath,
  3. required AssetType fileType,
  4. String? dstPath,
  5. String? message,
})

Share local file to Telegram platform.

The method required a local video file path (filePath), a custom file provider path (fileProviderPath => use on Android platform) and a fileType that you want to share. Besides, you can provide a dstPath (use on Android platform) to add a custom save folder path to cache the local file.

NOTE:

  • Because it is not possible to open WhatsApp directly to share a file on iOS. So the plugin will use the UIDocumentInteractionController in Swift to share the file.
  • The message property will work only on Android platform because WhatsApp don't have any API that support to share file and text together on iOS.

Working on: Android and iOS platforms.

Implementation

Future<dynamic> shareFileToWhatsApp({
  required String? filePath,
  required String fileProviderPath,
  required AssetType fileType,
  String? dstPath,
  String? message,
}) async {
  String type = AssetType.values[fileType.index].name;

  return _channel.invokeMethod(
    'shareFileWhatsApp',
    <String, dynamic>{
      'filePath': filePath,
      'fileProviderPath': fileProviderPath,
      'fileType': type,
      'dstPath': dstPath,
      'message': message,
    },
  );
}