shareFileToFacebook method

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

Share local file (video or image) to Facebook method. This method is merged from shareVideoToFacebook and sharePhotoToFacebook methods.

The method required a local video file path (filePath) and a custom file provider path (fileProviderPath => use on Android platform) to access the local file. Besides, you can provide a dstPath (Android platform) to add a custom save folder path to cache the local file, and there are some other properties pageId, peopleIds, hashtag, etc.

Only AssetType.video and AssetType.image are supported.

Working on: Android and iOS platforms.

Implementation

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

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