ShekarMudaliyar / social_share

Flutter package to share images/videos/text on social media
https://pub.dev/packages/social_share
MIT License
107 stars 175 forks source link

Can't share to Facebook and Instagram because the image to share can't be found #12

Open jagged91 opened 4 years ago

jagged91 commented 4 years ago

Hey,

I tried using this plugin to share to facebook and instagram but the plugin can't find my image files in 'assets', even though I know they exist (through Image.asset("assets/etc.png").

For example, this throws a File Not Found error:

SocialShare.shareInstagramStory( "assets/instagram.png", "#6041B1", "#ffffff", "our link url");

@ShekarMudaliyar how do I correctly use images from the assets folder? I've followed all the setup steps mentioned in the readme file.

Thanks!

ShekarMudaliyar commented 4 years ago

it takes a File as a parameter and not an asset, so you have to create a File object for that asset https://stackoverflow.com/questions/55295593/how-to-convert-asset-image-to-file Check this out convert it to File and add file.path instead of "assets/image.png"

kaarens93 commented 4 years ago

hi @ShekarMudaliyar Thank you for the link. Which step do we add "file.path" instead of "assets/image.png" ? I'm looking at the first answer but I'm not sure where to add file.path. Thanks for your help!

ShekarMudaliyar commented 4 years ago

hi @ShekarMudaliyar Thank you for the link. Which step do we add "file.path" instead of "assets/image.png" ? I'm looking at the first answer but I'm not sure where to add file.path. Thanks for your help!

@kaarens93 You first have to follow the steps from the link and convert the asset to File object & then u can use it here as file.path SocialShare.shareInstagramStory( file.path, "#6041B1", "#ffffff", "our link url");