Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter IOS Duplicate plugin key: SocialSharePlugin

I am using two different share plugins in my flutter project. One plugin social_share_plugin and other is social_share . Both are used to share content on social media. Due to limitation of one plugin i have to use both. But i am getting 'Duplicate plugin key: SocialSharePlugin'error when i run the project on IOS device. it is working fine on android device.

 var s = await SocialSharePlugin.shareToFeedFacebookLink(
                    quote: 'Meeting',
                    url: shareLink,
                  );

and other plugin is used like

await SocialShare.shareTwitter(
                      shareText,
                      hashtags: ["meetup"],
                      url: shareLink,
                      trailingText: '#meeting',
                    );
              
like image 305
Bilal Rabbi Avatar asked Apr 09 '26 21:04

Bilal Rabbi


1 Answers

The issue is social_share uses the same class name as social_share_plugin (they both have SocialSharePlugin). To resolve this, I forked the social_share package and changed every instance of SocialSharePlugin to SocialShare, including the file names.

Here's my forked repo if you would like to use or view: https://github.com/kaarens93/social_share (I have a lot of 'unresolved reference' errors that I'm still in the process of fixing but unless you want to build the package, you shouldn't run into any issues implementing into your project)

like image 200
Karen Avatar answered Apr 11 '26 19:04

Karen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!