In my app, I have a button and I need it to share Facebook when this button is clicked?
You don't need your app to be running at all times to receive the data (through intent filter) and Flutter has nothing to do anything with it. Just open your AndroidManifest. xml file, add your intent-filter , there, its type and so on.
Check out flutter share plugin
https://pub.dev/packages/share_plus
Share.share('check out my website https://example.com');
Then users can choose to use facebook or any other service that supports share interface
You can try this package: https://pub.dev/packages/wc_flutter_share
This package supports sharing image + text both.
You can use this like:
await WcFlutterShare.share(
sharePopupTitle: 'share',
subject: 'This is subject',
text: 'This is text',
fileName: 'share.png',
mimeType: 'image/png',
bytesOfFile: bytes.buffer.asUint8List());
Note: On facebook you can't share image and text at the same time. You can either share text or image.
try this: https://github.com/d-silveira/flutter-share.git
if you want to share something other than text.
it allows sharing text/image/file with a simple named constructor instantiation Share.image(path: <PATH>, title: <TITLE>)
and then call share()
on it
just follow the instructions for further details on the README or see a working example in the example project folder.
It is fully functional for Android, the IOS part is currently being developed to match the Android part.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With