Share Intent Package

Flutter plugin for seamless sharing between apps. Receive and send text, images, videos, files with zero manual configuration.

pub package Platform

☕ Support & Donate

If this package helped you, consider buying me a coffee! Your support helps maintain and improve this package.

Donate via ABA QR

Scan to donate via ABA Bank
Thank you for your support! 🙏


🔥 Latest Update (v1.0.31)

EXCLUDE OWN APP TARGET: Automatically filters out the current app from showing up as a destination in its own sharesheet on both iOS and Android.

  • ✅ iOS Blocker UTI: Injected an unconditional blocker UTI that hides the app's extension during the system discovery phase.
  • ✅ Android Chooser Exclude: Automatically queries the package manager and adds the app's own activities to Intent.EXTRA_EXCLUDE_COMPONENTS.
  • ✅ Automated Setup CLI: Setup scripts now generate the correct Info.plist activation rules out of the box.

✨ 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. Cleanup / Revert Setup (Optional)

If you ever need to completely remove the configurations and restore your original project files:

Revert iOS Setup:

dart run share_intent_package:clear_ios
cd ios && pod install && cd ..

Revert Android Setup:

dart run share_intent_package:clear_android

4. 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 ..

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