Easily share content like text, image or any file to other apps.
Both Android and iOS platforms are supported, no additional changes are required in native code or projects. Except, the Specific permissions (like Storage Access permission), you'll need to add that in your project manually.
That's it. Now, you are ready to go.
Share only text:
String text = "Check out this plugin: https://pub.dev/packages/flutter_share_plugin "; FlutterShare.shareText(text);
Share only file:
String filePath = bohemianRhapsodySong.absolute.path; // pass the string as `filePath` parameter FlutterShare.shareFile(filePath: filePath);
Uint8List bytes = bohemianRhapsodySong.readAsBytes(); // pass the Uint8List data as `bytes` parameter FlutterShare.shareFile(bytes: bytes);
Share file and text content:
// use preferred method here to get URI string of the file String uri = screenshot.absolute.path; String text = "Transaction Screenshot"; FlutterShare.shareFileWithText( textContent: text, filePath: uri);
// use preferred method here to get bytes of the files Uint8List bytes = screenshot.readAsBytes(); String text = "Transaction Screenshot"; FlutterShare.shareFileWithText( textContent: text, bytes: bytes);
Share text only
Share a file with text