shareFileToMessenger method

Future shareFileToMessenger({
  1. required String? filePath,
  2. required String fileProviderPath,
  3. required AssetType fileType,
  4. String? dstPath,
  5. String? pageId,
  6. String? ref,
  7. List<String>? peopleIds,
  8. String? placeId,
  9. String? hashtag,
  10. String? contentUrl,
  11. String? previewImagePath,
})

Share local file (video or image) to Messenger method.

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 the dstPath (use on Android platform) to add a custom save folder path to cache the local file.

Only AssetType.video and AssetType.image are supported.

iOS properties: pageId, peopleIds, hashtag, etc.

Working on: Android and iOS platforms.

Implementation

Future<dynamic> shareFileToMessenger({
  required String? filePath,
  required String fileProviderPath,
  required AssetType fileType,
  String? dstPath,
  String? pageId,
  String? ref,
  List<String>? peopleIds,
  String? placeId,
  String? hashtag,
  String? contentUrl,
  String? previewImagePath,
}) async {
  assert(
    fileType == AssetType.video || fileType == AssetType.image,
    "Only video and image types are supported",
  );

  return _channel.invokeMethod(
    'shareFileMessenger',
    {
      'fileType': fileType.name,
      'filePath': filePath,
      'fileProviderPath': fileProviderPath,
      'dstPath': dstPath,
      'pageId': pageId,
      'ref': ref,
      'peopleIds': peopleIds,
      'placeId': placeId,
      'hashtag': hashtag,
      'contentUrl': contentUrl,
      'previewImagePath': previewImagePath,
    },
  );
}