share_intent_package 1.0.21
share_intent_package: ^1.0.21 copied to clipboard
Zero-configuration Flutter share intent plugin. Receive shared content from other apps with one-command setup. Fully automated iOS ShareExtension + Android intent filters.
Share Intent Package #
Flutter plugin for seamless sharing between apps. Receive and send text, images, videos, files with zero manual configuration.
✨ Key Features #
- 🚀 Fully Automatic Setup - Zero manual Xcode/Android Studio steps
- 📱 All Content Types - Text, images, videos, files
- 🔄 Hot & Cold Start - Handle sharing in all app states
- 📤 Two-Way Sharing - Receive from & share to other apps
- 🎯 Production Ready - Type-safe API with error handling
🚀 Quick Start #
1. Installation #
flutter pub add share_intent_package
2. Automatic Setup #
dart run setup_android
```bash
```bash
dart run setup_ios_clean
cd ios && pod install && cd ..
✅ Auto-creates ShareExtension
✅ Auto-configures App Groups
✅ Auto-embeds in main app
Android (Complete Automation):
dart run setup_android
✅ Auto-adds intent filters
✅ Auto-configures permissions
3. Usage (3 Lines of Code) #
import 'package:share_intent_package/share_intent_package.dart';
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
// Handle shared content on app launch (cold start)
ShareIntentPackage.instance.getInitialSharing().then((content) {
if (content != null) _processContent(content);
});
// Handle shared content while app running (hot start)
ShareIntentPackage.instance.getMediaStream().listen(_processContent);
}
void _processContent(SharedData content) {
if (content.text != null) {
print('Received text: ${content.text}');
// Handle shared text/URLs
}
if (content.filePaths.isNotEmpty) {
print('Received ${content.filePaths.length} files');
// Handle shared files (images, videos, documents)
}
}
}
📤 Share Content #
// Share text
await ShareIntentPackage.shareText('Hello World!');
// Share files
await ShareIntentPackage.shareFiles(['/path/to/image.jpg']);
// Share mixed content
await ShareIntentPackage.shareContent(
text: 'Check this out!',
filePaths: ['/path/to/file.pdf'],
);
📋 API Reference #
| Method | Description | Returns |
|---|---|---|
getInitialSharing() |
Get content shared on cold start | Future<SharedData?> |
getMediaStream() |
Listen for shared content | Stream<SharedData> |
shareText(String text) |
Share text to other apps | Future<void> |
shareFiles(List<String> paths) |
Share files to other apps | Future<void> |
shareContent({text, filePaths}) |
Share mixed content | Future<void> |
SharedData Object:
class SharedData {
final String? text; // Shared text
final List<String> filePaths; // File paths
final String? mimeType; // Content MIME type
// Helper properties
bool get hasContent; // Has any content
bool get isImage; // Is image content
bool get isVideo; // Is video content
bool get isUrl; // Is URL content
}
📱 Supported Content #
| Type | iOS | Android | Examples |
|---|---|---|---|
| Text | ✅ | ✅ | Plain text, URLs, rich text |
| Images | ✅ | ✅ | JPG, PNG, GIF, WebP |
| Videos | ✅ | ✅ | MP4, MOV, AVI |
| Documents | ✅ | ✅ | PDF, DOC, XLS, ZIP |
| Multiple Files | ✅ | ✅ | Mixed content types |
🔧 Requirements #
- Flutter: ≥3.0.0
- iOS: ≥11.0
- Android: API ≥21 (Android 5.0)
🐛 Troubleshooting #
iOS Build Errors:
- Ensure you're in Flutter project root when running setup
- Clean build:
flutter clean && cd ios && pod install
Android Content Not Received:
- Verify setup completed successfully
- Check intent filters in AndroidManifest.xml
Debug Mode:
ShareIntentPackage.enableDebugMode(true);
📄 License #
MIT License - see LICENSE file for details.
- Example: Check the example app for complete implementation
- Issues: Report on GitHub