Share Intent Package
Flutter plugin for seamless sharing between apps. Receive and send text, images, videos, files with zero manual configuration.
☕ Support & Donate
If this package helped you, consider buying me a coffee! Your support helps maintain and improve this package.
Scan to donate via ABA Bank
Thank you for your support! 🙏
🔥 Latest Update (v1.0.28)
CRITICAL BUG FIX: Multiple file sharing now works correctly! Fixed iOS ShareExtension bug where sharing 2+ photos only showed the last file.
- ✅ Fixed Multiple Files: Sharing multiple photos/files now displays all files correctly
- ✅ Enhanced Logging: Comprehensive debugging with
[BidirectionalShareExt]tags - ✅ Improved Setup: Updated
setup_ios_cleangenerates corrected ShareExtension code - ✅ 40+ File Types: Support for images, videos, audio, PDFs, documents, archives
✨ Key Features
- 🚀 Fully Automatic Setup - Zero manual Xcode/Android Studio steps
- 📱 All Content Types - Text, images, videos, files (40+ types supported)
- 🔄 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
- 📁 Multiple Files - Properly handles sharing multiple files simultaneously
🚀 Quick Start
1. Installation
flutter pub add share_intent_package
2. Automatic Setup
iOS Setup:
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 Setup:
dart run share_intent_package:setup_android
✅ Auto-adds intent filters
✅ Auto-configures permissions
3. Usage (Clean & Simple)
import 'package:flutter/material.dart';
import 'package:share_intent_package/share_intent_package.dart';
class _MyAppState extends State<MyApp> {
List<SharedData> receivedData = [];
String statusMessage = 'Waiting for shared content...';
@override
void initState() {
super.initState();
initShareListener();
}
void initShareListener() async {
try {
// Handle shared content on app launch (cold start)
final initialContent = await ShareIntentPackage.instance.getInitialSharing();
if (initialContent != null) {
setState(() {
receivedData.insert(0, initialContent);
statusMessage = 'Received initial share!';
});
}
// Handle shared content while app running (hot start)
ShareIntentPackage.instance.getMediaStream().listen((content) {
setState(() {
receivedData.insert(0, content);
statusMessage = 'Received new share!';
});
});
} catch (e) {
setState(() {
statusMessage = 'Error: $e';
});
}
}
// Use receivedData list to display shared content
// Each SharedData contains: text, filePaths, mimeType
}
📤 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, HEIC, BMP |
| Videos | ✅ | ✅ | MP4, MOV, AVI, QuickTime |
| Audio | ✅ | ✅ | MP3, WAV, M4A, AAC |
| Documents | ✅ | ✅ | PDF, DOC, DOCX, XLS, XLSX |
| Archives | ✅ | ✅ | ZIP, RAR, 7Z |
| Multiple Files | ✅ | ✅ | 2+ files of any type (FIXED!) |
🔥 New in v1.0.25: Multiple file sharing completely fixed - share 2+ photos and see all files!
🔧 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
- Run setup:
dart run share_intent_package:setup_ios_clean - Clean build:
flutter clean && cd ios && pod install && cd ..
Multiple Files Showing Only 1 File (FIXED in v1.0.25):
- Update to v1.0.25:
flutter pub upgrade share_intent_package - Re-run setup:
dart run share_intent_package:setup_ios_clean - The ShareExtension will be regenerated with the fixed code
Android Content Not Received:
- Run setup:
dart run share_intent_package:setup_android - Verify setup completed successfully
- Check intent filters in AndroidManifest.xml
Debug Mode & Logging:
ShareIntentPackage.enableDebugMode(true);
iOS ShareExtension logs are visible with [BidirectionalShareExt] tags for detailed debugging.
📄 License
MIT License - see LICENSE file for details.
- Example: Check the example app for complete implementation
- Issues: Report on GitHub