A Flutter plugin to share content from your Flutter app via the platform's share dialog.
Wraps the ACTION_SEND Intent on Android and UIActivityViewController on iOS.
Can also open directly (without the share dialog) some common sharing apps (using URL Scheme). Currently supported apps:
- Twitter
- Telegram
- WhatsApp
- Email
To use this plugin, add share
as a dependency in your pubspec.yaml file.
On IOS, to open the supported sharing apps without the share dialog, you need to add the corresponding URL Schemes to the list of LSApplicationQueriesSchemes
in the Runner/Info.plist
.
- Twitter: `twitter`
- Telegram: `tg`
- WhatsApp: `whatsapp`
- Email: `mailto`
Example:
<key>LSApplicationQueriesSchemes</key>
<array>
<string>tg</string>
<string>whatsapp</string>
<string>twitter</string>
<string>mailto</string>
</array>
Import the library via
import 'package:share/share.dart';
Invoke the static openShareDialog
method anywhere in your Dart code.
Share.openShareDialog('check out my website https://example.com');
Invoke the static listKnownAvailableSharingApps
method anywhere in your Dart code.
First check the app is installed and available with listKnownAvailableSharingApps
.
Then call the corresponding function:
Share.shareWithTwitter('check out my website https://example.com');
Or
Share.shareWithTelegram('check out my website https://example.com');
...