← ClaudeAtlas

flutter-sharelisted

Share content via the native share sheet
noory-code/noory-ai · ★ 0 · AI & Automation · score 74
Install: claude install-skill noory-code/noory-ai
# Flutter Share Plus Share text, URLs, and files via the native share sheet. --- ## Installation ```bash flutter pub add share_plus ``` --- ## Quick Reference ### Share Text ```dart import 'package:share_plus/share_plus.dart'; // plain text await Share.share('Text to share'); // with subject await Share.share( 'Text to share', subject: 'Share title', // used as the email subject, etc. ); ``` ### Share URL ```dart await Share.shareUri(Uri.parse('https://example.com')); // text and URL together await Share.share('Check out this link!\nhttps://example.com'); ``` ### Share Files ```dart // single file await Share.shareXFiles( [XFile('/path/to/image.png')], text: 'Sharing a photo', ); // multiple files await Share.shareXFiles([ XFile('/path/to/image1.png'), XFile('/path/to/image2.png'), ]); // share directly from memory final bytes = await generateImage(); await Share.shareXFiles( [XFile.fromData(bytes, name: 'image.png', mimeType: 'image/png')], ); ``` ### Check Share Result ```dart final result = await Share.shareWithResult( 'Text to share', ); switch (result.status) { case ShareResultStatus.success: print('Share successful'); break; case ShareResultStatus.dismissed: print('User dismissed'); break; case ShareResultStatus.unavailable: print('Share unavailable'); break; } ``` ### Specify Position (iPad) ```dart // specify the popover origin on iPad await Share.share( 'Text to share', sharePositionOrigin: Rect