shareImage method
Share an image to Facebook with optional caption.
Implementation
Future<ShareResult> shareImage(
String imagePath, {
String? caption,
}) async {
if (!isInitialized) {
return ShareResult.error(
ShareErrorCode.initializationFailed,
'Facebook SDK not initialized. Call init() first.',
);
}
if (imagePath.isEmpty) {
return ShareResult.error(
ShareErrorCode.invalidPath,
'Image path cannot be empty',
);
}
final request = ShareImageRequest(
imagePath: imagePath,
caption: caption,
platform: SocialPlatform.facebook,
);
return FacebookPlatformInterface.instance.shareImage(request);
}