Skip to content
pubscout

file_share_intent

3.0.3, released 11 months ago by waltertay.com

Receive shared content, media files, documents, text, and URLs from external apps via Android and iOS.

WASM-ready
$ flutter pub add file_share_intent
Source repository

What it does

Implements Android Intent and iOS Share Extension handlers so your Flutter app can receive incoming media, text, files, and URLs shared from other external applications. Provides streams and methods to fetch both active and initial shared content.

AI-written summary of version 3.0.3, based on the package's README and metadata. Report an inaccuracy

Use it when

  • Your app needs to receive shared files, images, videos, or text from other applications on Android and iOS.
  • You want a WhatsApp-style seamless share extension on iOS without a compose dialog popup.

Skip it when

  • You only need to share content outward from your app (use share_plus instead).
  • You require direct photo library asset identifiers on iOS (PHAsset identifiers are not supported).

Strengths

  • Supports both Android Intents and iOS Share Extensions.
  • Does not require the NSPhotoLibraryUsageDescription permission on iOS since it shares files via file URLs.
  • Provides both a seamless modern share view controller and a legacy compose dialog controller on iOS.

Weaknesses

  • Requires manual native setup on both Android (AndroidManifest.xml) and iOS (Share Extension target, Info.plist, entitlements, Podfile, and Swift view controller subclassing).
  • Photo library asset identifiers return null instead of file paths on iOS.

Setup

Kind
Plugin (native code)
Effort
High
Code generation
No
Direct dependencies
1

Requires modifying AndroidManifest.xml intent filters, creating an iOS Share Extension target, configuring App Groups, Podfile updates, and writing custom Swift view controller subclasses.

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:file_share_intent/file_share_intent.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  late StreamSubscription _intentSub;
  final _sharedFiles = <SharedMediaFile>[];

  @override
  void initState() {
    super.initState();
    _intentSub = FileShareIntent.instance.getMediaStream().listen((value) {
      setState(() {
        _sharedFiles.clear();
        _sharedFiles.addAll(value);
      });
    });
  }

  @override
  Widget build(BuildContext context) => MaterialApp(home: Scaffold(body: Center(child: Text('Shared files: ${_sharedFiles.length}'))));
}

Alternatives

Packages that do the same job and could replace file_share_intent.

Works with

Packages commonly used together with file_share_intent: ones it builds on, ones built on it, and its own family.