share_intent_package 1.0.4
share_intent_package: ^1.0.4 copied to clipboard
The easiest Flutter share intent plugin. Receive text, images, videos, documents from other apps with automated setup. iOS ShareExtension + Android intent filters made simple.
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 #
iOS (Complete Automation):
dart run share_intent_package: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 share_intent_package: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 MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
// Handle shared content on app launch (cold start)
ShareIntentPackage.getInitialSharedContent().then((content) {
if (content != null) _processContent(content);
});
// Handle shared content while app running (hot start)
ShareIntentPackage.getSharedContentStream().listen(_processContent);
}
void _processContent(Map<String, dynamic> content) {
final text = content['text'];
final files = content['filePaths']?.cast<String>();
if (text != null) {
print('Received text: $text');
// Handle shared text/URLs
}
if (files != null) {
print('Received ${files.length} files: $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 |
|---|---|---|
getInitialSharedContent() |
Get content shared on cold start | Future<Map<String, dynamic>?> |
getSharedContentStream() |
Listen for shared content | Stream<Map<String, dynamic>> |
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> |
Content Format:
{
'text': String?, // Shared text
'filePaths': List<String>?, // File paths
'mimeType': String? // Content MIME type
}
📱 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.