share_intent_package 1.0.23
share_intent_package: ^1.0.23 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 #
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 |
| 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
- Run setup:
dart run share_intent_package:setup_ios_clean - Clean build:
flutter clean && cd ios && pod install && cd ..
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:
ShareIntentPackage.enableDebugMode(true);
📄 License #
MIT License - see LICENSE file for details.
- Example: Check the example app for complete implementation
- Issues: Report on GitHub